Tab notes should not be saved when input contains only spaces
Categories
(Firefox :: Tabbed Browser, defect, P2)
Tracking
()
People
(Reporter: rpopovici, Assigned: chimaifeanyi29, Mentored)
References
(Blocks 2 open bugs)
Details
(Keywords: good-first-bug, Whiteboard: [fidefe-tabgrps][outreachy-sidebar-2026])
Attachments
(2 files)
Note
- The user should not be able to save a note when input contains only space(s). This could be an improvement.
Found in
- Nightly v149.0a1
Affected versions
- Nightly v149.0a1
Tested platforms
- Affected platforms: all
- Unaffected platforms: none
Steps to reproduce
- Load any website
- Right-click to add a note
- Press the "Space" key and save the note
- Hover the tab and observe the note
Expected result
- Tab notes should not be saved when input contains only space(s).
Actual result
- An empty note is displayed on hovering.
Regression range
- Not a regression.
Updated•6 months ago
|
| Reporter | ||
Updated•6 months ago
|
| Reporter | ||
Updated•6 months ago
|
Updated•6 months ago
|
| Reporter | ||
Updated•6 months ago
|
Comment 1•5 months ago
|
||
I believe our spec indicated that tab notes should not be saved when the text is empty, so I consider this a bug. Thank you.
Comment 2•4 months ago
|
||
In the following two places, we check the length of the text in the note textarea in order to determine whether to allow a note to be saved:
- https://searchfox.org/firefox-main/rev/1427c88632d1474d2653928745d78feca1a64ee0/browser/components/tabbrowser/content/tabnote-menu.js#179-190 to disable the "Save" button when note text is empty
- https://searchfox.org/firefox-main/rev/1427c88632d1474d2653928745d78feca1a64ee0/browser/components/tabbrowser/content/tabnote-menu.js#261 to skip saving a note if the note text is empty
In both of these cases, if the note text is " " (5 spaces), then the note will be saved. However, we do not want to save empty notes!
Instead of using the character count of the textarea element as this.#noteField.value.length, we should use the character count of the textarea element after trimming beginning and ending whitespace from the text. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim is a built-in way to trim whitespace from a string value.
We should add a new test case next to this existing test https://searchfox.org/firefox-main/rev/1427c88632d1474d2653928745d78feca1a64ee0/browser/components/tabnotes/test/browser/browser_tab_notes_menu.js#354-396 When the note textarea contains only whitespace (spaces, newlines, etc.) then the Save button should be disabled.
Updated•4 months ago
|
Updated•4 months ago
|
Comment 7•4 months ago
|
||
| bugherder | ||
Comment 8•4 months ago
|
||
Since nightly and release are affected, beta will likely be affected too.
For more information, please visit BugBot documentation.
Comment 9•4 months ago
|
||
The patch landed in nightly and beta is affected.
:chimaifeanyi29, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- See https://wiki.mozilla.org/Release_Management/Requesting_an_Uplift for documentation on how to request an uplift.
- If no, please set
status-firefox150towontfix.
For more information, please visit BugBot documentation.
Comment 10•4 months ago
|
||
Checking with :sthompson on if this should be uplifted to beta or not
Updated•4 months ago
|
Updated•4 months ago
|
Description
•