8000 Make results table title editable by kala-moz · Pull Request #848 · mozilla/perfcompare · GitHub
[go: up one dir, main page]

Skip to content

Conversation

kala-moz
Copy link
Contributor
@kala-moz kala-moz commented Jan 28, 2025

Closes issues Allow users to change the page title of PerfCompare and have the title persist in the url

Deploy preview

UPDATED. Please read before reviewing. The last commit replaces the form in EditTitleInput with Form from react-router-dom and adds a new method on onSaveSubmit to better handle the form submission and error case.

In response to first review, please check the following commits:

The following below are handled but this last commit:

  • Refactored the form and submission in EditTitleInput
  • Fix truncation of the last letter
  • Allow for updates when the user key presses the enter button
  • Esc key press for cancel
  • Moved error handling to edit title input prop
  • add remaining tests for coverage

Updated preview shots:

Screenshot 2025-02-03 at 16 45 05 Screenshot 2025-02-03 at 16 45 24 Screenshot 2025-02-03 at 16 46 37

Outdated: This is split into 5 commits atm to make it easier to review. I'd like a review now before adding the logic to the other Results View pages

@kala-moz kala-moz added the 🚧 WIP 🚧 Work in progress: do not merge label Jan 28, 2025
Copy link
netlify bot commented Jan 28, 2025

Deploy Preview for mozilla-perfcompare ready!

Name Link
🔨 Latest commit 9ddd150
🔍 Latest deploy log https://app.netlify.com/sites/mozilla-perfcompare/deploys/67d8b7d287433500075a3b73
😎 Deploy Preview https://deploy-preview-848--mozilla-perfcompare.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
codecov bot commented Jan 28, 2025

Codecov Report

Attention: Patch coverage is 98.46154% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.67%. Comparing base (6b233b3) to head (9ddd150).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/components/CompareResults/EditTitleInput.tsx 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #848      +/-   ##
==========================================
+ Coverage   93.56%   93.67%   +0.10%     
==========================================
  Files          94       95       +1     
  Lines        2643     2704      +61     
  Branches      526      535       +9     
==========================================
+ Hits         2473     2533      +60     
- Misses        152      153       +1     
  Partials       18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@kala-moz kala-moz changed the title WIP: Make results table title editable Make results table title editable Jan 31, 2025
@kala-moz kala-moz added Ready For Review and removed 🚧 WIP 🚧 Work in progress: do not merge labels Jan 31, 2025
@julienw
Copy link
Contributor
julienw commented Jan 31, 2025

thanks for working on it!
I couldn't look at the code, but there are a few bugs I could see:

  1. the URL doesn't have the latest version of the text, it's the text minus one letter
  2. pressing doesn't work, one has to go and click "save"
  3. pressing "cancel" doesn't work (at least when there was a previous text), the text is replaced by the one currently entered, not the previous one
  4. when editing when we already entered a text before, the previous text is written as a placeholder, it should be a preselected value (see the behavior at the top left of the profiler UI)
  5. The "edit title" seems a bit prominent, I would think that just the iconbutton (with a title of course) would be good enough here. I'd also center it better but for that I'm not so sure.

Otherwise I'm not sure if the title should be here or rather at the "Results" title part (or next to the results part). But also I think it's pretty fine and I don't have a real good opinion, so if you prefer it there I'm fine with it too.

Thanks again!

@kala-moz
Copy link
Contributor Author
kala-moz commented Feb 4, 2025

thanks for working on it! I couldn't look at the code, but there are a few bugs I could see:

1. the URL doesn't have the latest version of the text, it's the text minus one letter

2. pressing  doesn't work, one has to go and click "save"

3. pressing "cancel" doesn't work (at least when there was a previous text), the text is replaced by the one currently entered, not the previous one

4. when editing when we already entered a text before, the previous text is written as a placeholder, it should be a preselected value (see the behavior at the top left of [the profiler UI](https://profiler.firefox.com/public/hqstgh4kre9beta1gq2q68dnp0g3v50q5gprjk0/calltree/?globalTrackOrder=0w3&hiddenGlobalTracks=1w3&hiddenLocalTracksByPid=347182-0wk~345944-0w5~345990-0w3~0-0&profileName=before%20change&thread=0&timelineType=category&v=10))

5. The "edit title" seems a bit prominent, I would think that just the iconbutton (with a title of course) would be good enough here. I'd also center it better but for that I'm not so sure.

Otherwise I'm not sure if the title should be here or rather at the "Results" title part (or next to the results part). But also I think it's pretty fine and I don't have a real good opinion, so if you prefer it there I'm fine with it too.

Thanks again!

Thanks for the review! My last two commits address concerns 3-5. Cancel button behaves as intended with corresponding test. And I stored the previous text as a value, not placeholder. I agree about moving the edit title feature down to the table. However, I'd like to keep the text "Edit title" to stay consistent with our editing UI re 'Edit entry'

I'll handle the URL and enter key presses in future commits. With that being said, would you like to see the 'save' button removed or should we allow for both to save the new title in the URL? I think both is better.

@julienw
Copy link
Contributor
julienw commented Feb 4, 2025

I agree about moving the edit title feature down to the table. However, I'd like to keep the text "Edit title" to stay consistent with our editing UI re 'Edit entry'

If it doesn't stay at the top, I think "Edit title" would be fine.
I think it was too visible and present at the top for its usefulness, but if we make it less prominent then it's OK.

@kala-moz kala-moz added 🚧 WIP 🚧 Work in progress: do not merge and removed Ready For Review labels Feb 5, 2025
@kala-moz kala-moz requested a review from julienw February 12, 2025 19:17
@kala-moz kala-moz added Ready For Review and removed 🚧 WIP 🚧 Work in progress: do not merge labels Feb 12, 2025
@julienw
Copy link
Contributor
julienw commented Feb 15, 2025

I didn't have the time to look at the code, but from the deploy preview I like it much more than before, good work!.

A couple comments:

  1. when starting the edition with the button, can you make it so that the text is fully selected and the input is focused? You should be able to do it with useEffect and a reference to the input (input.focus(); input.select(););
  2. also I noticed that the stylized underline for the main "perfcompare" title at the top seems incorrectly moved to the right.
  3. You need to rebase, a lot of snapshots are conflicted. Also because you don't want that we look at individual commits here, you could squash all your commits before rebase which should make it easier.

Now or as a follow-up:

  • Change window.title to account for the new title, so that the users can find it in their history more easily (which is IMO a goal)

As a follow-up, once the implementation has been approved as well:

  • Do the same thing for the subtests page

@kala-moz kala-moz force-pushed the make-results-table-title-editable branch 2 times, most recently from 5214ee0 to 6ced3cb Compare February 25, 2025 01:43
@kala-moz
Copy link
Contributor Author

Ahhhh, @julienw, unfortunately I rebased then squashed my commits. I apologize. Hopefully, it's not too hard to review. :-/

@kala-moz kala-moz force-pushed the make-results-table-title-editable branch from bedfafc to a6051c3 Compare February 27, 2025 03:54
@kala-moz
Copy link
Contributor Author

#Now or as a follow-up:

Change window.title to account for the new title, so that the users can find it in their history more easily (which is IMO a goal)

As a follow-up, once the implementation has been approved as well:

Do the same thing for the subtests page

I'll take care of the above in follow-up PRs, @julienw

@kala-moz kala-moz force-pushed the make-results-table-title-editable branch from a6051c3 to 5c5f5dc Compare February 27, 2025 20:23
Copy link
Contributor
@julienw julienw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, the behavior looks better!

I left a few small comments, tell me what you think.
Especially I don't understand the dance with the slug.

Also, I still don't see this:

when starting the edition with the button, can you make it so that the text is fully selected and the input is focused? You should be able to do it with useEffect and a reference to the input (input.focus(); input.select();).

@kala-moz
Copy link
Contributor Author
kala-moz commented Mar 6, 2025
Also, I still don't see this:
when starting the edition with the button, can you make it so that the text is fully selected and the input is focused? 
You should be able to do it with useEffect and a reference to the input (input.focus(); input.select();).

@julienw Doesn't this line solve making sure the input is focused and the text is selected? https://github.com/Carla-Moz/perfcompare/blob/3e5025b4e8747221bd4ddd1b8cf1fb3cb0396ba5/src/components/CompareResults/EditTitleInput.tsx#L67

@julienw
Copy link
Contributor
julienw commented Mar 7, 2025
Also, I still don't see this:
when starting the edition with the button, can you make it so that the text is fully selected and the input is focused? 
You should be able to do it with useEffect and a reference to the input (input.focus(); input.select();).

@julienw Doesn't this line solve making sure the input is focused and the text is selected? https://github.com/Carla-Moz/perfcompare/blob/3e5025b4e8747221bd4ddd1b8cf1fb3cb0396ba5/src/components/CompareResults/EditTitleInput.tsx#L67

This makes it so that the input is selected when it's focused (and it's good!), but not that it's focused when the user presses "edit". This makes that the user needs an extra click to edit the title, which we can avoid.

@kala-moz
Copy link
Contributor Author
kala-moz commented Mar 12, 2025
Also, I still don't see this:
when starting the edition with the button, can you make it so that the text is fully selected and the input is focused? 
You should be able to do it with useEffect and a reference to the input (input.focus(); input.select();).

@julienw Doesn't this line solve making sure the input is focused and the text is selected? https://github.com/Carla-Moz/perfcompare/blob/3e5025b4e8747221bd4ddd1b8cf1fb3cb0396ba5/src/components/CompareResults/EditTitleInput.tsx#L67

This makes it so that the input is selected when it's focused (and it's good!), but not that it's focused when the user presses "edit". This makes that the user needs an extra click to edit the title, which we can avoid.

Not to be annoying, why is it necessary to have the input focused when the user presses the Edit button vs when the user hovers over, clicks on, or starts typing in the Edit input? In terms of accessibility, we already have an aria label that lets users know this input is for editing the comparison title. I'm not convinced the extra code is worth saving the user one click for a behavior that is quite normal.

@julienw
Copy link
Contributor
julienw commented Mar 12, 2025

Think aboug the whole process of editing the title:
When using the mouse to click the edit button, this is one less click.
When using the keyboard to click the edit button, this is also much more easier to use as it doesn't require a backwards tabulation.

Note that I'm not saying to remove your "select on focus" behavior ! Only to add a "focus on edit" behavior. Is there a reason you don't like it? I'd like to understand :-)

Thanks

@kala-moz
Copy link
Contributor Author
kala-moz commented Mar 12, 2025

Think aboug the whole process of editing the title: When using the mouse to click the edit button, this is one less click. When using the keyboard to click the edit button, this is also much more easier to use as it doesn't require a backwards tabulation.

Note that I'm not saying to remove your "select on focus" behavior ! Only to add a "focus on edit" behavior. Is there a reason you don't like it? I'd like to understand :-)

Thanks

I suppose. I'll go ahead and add the focus on edit button click but I'd like to talk about it when you return lol.

kala-moz added 11 commits March 12, 2025 16:02
Need to add logic to save title name in url
also improved name of editTitleInput
Increased width of the header title
Also changed the title names to comparisonTitle to no be confused with page title
Increased width of title too
correctly updated snapshots
moved edit title to result table header and removed edit references in other views

fix cancel button and add corresponding test

This makes sure the previous state is stored and shown when the user hits the cancel button

moved save and cancel buttons

Also added form to handle submissions (save and enter key press)
- Handled esc key for cancel
- fixed truncated last letter bug for onChange
-moved error state to edit title input comp
-next need to add tests for error cases and title save

refactored EditTitleInput and added remaining test for url update

Added PR notes and will remove once approved
Copy link
Contributor
@julienw julienw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is so much clearer!

I have 1 or 2 more nits but otherwise this is good to go IMO :-)

@kala-moz kala-moz merged commit 79dfc92 into mozilla:main Mar 18, 2025
10 checks passed
sumairq pushed a commit to sumairq/perfcompare that referenced this pull request Mar 20, 2025
* added the edit icon beside results page title

* added edit title input component

Need to add logic to save title name in url

* add editable title to other results page views

* added save button to editable view

also improved name of editTitleInput
Increased width of the header title

* added logic to save title to url and update title in ui

Also changed the title names to comparisonTitle to no be confused with page title
Increased width of title too

* rebased and updated

correctly updated snapshots
moved edit title to result table header and removed edit references in other views

fix cancel button and add corresponding test

This makes sure the previous state is stored and shown when the user hits the cancel button

moved save and cancel buttons

Also added form to handle submissions (save and enter key press)
- Handled esc key for cancel
- fixed truncated last letter bug for onChange
-moved error state to edit title input comp
-next need to add tests for error cases and title save

refactored EditTitleInput and added remaining test for url update

Added PR notes and will remove once approved

* add focus to input and fix header img

* resolved ResultsMain comments

* resolved EditTitleInput comments

* add  coverage for error case

* add focus and select ref on edit button click

* resolved latest comments
sumairq pushed a commit to sumairq/perfcompare that referenced this pull request Mar 20, 2025
* added the edit icon beside results page title

* added edit title input component

Need to add logic to save title name in url

* add editable title to other results page views

* added save button to editable view

also improved name of editTitleInput
Increased width of the header title

* added logic to save title to url and update title in ui

Also changed the title names to comparisonTitle to no be confused with page title
Increased width of title too

* rebased and updated

correctly updated snapshots
moved edit title to result table header and removed edit references in other views

fix cancel button and add corresponding test

This makes sure the previous state is stored and shown when the user hits the cancel button

moved save and cancel buttons

Also added form to handle submissions (save and enter key press)
- Handled esc key for cancel
- fixed truncated last letter bug for onChange
-moved error state to edit title input comp
-next need to add tests for error cases and title save

refactored EditTitleInput and added remaining test for url update

Added PR notes and will remove once approved

* add focus to input and fix header img

* resolved ResultsMain comments

* resolved EditTitleInput comments

* add  coverage for error case

* add focus and select ref on edit button click

* resolved latest comments
@kala-moz kala-moz mentioned this pull request Mar 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No 442A ne yet
Development

Successfully merging this pull request may close these issues.

2 participants
0