Context menu API: White space is collapsed in menu items
Categories
(WebExtensions :: Frontend, defect, P3)
Tracking
(firefox-esr102 unaffected, firefox110 wontfix, firefox111 wontfix, firefox112 wontfix)
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | unaffected |
firefox110 | --- | wontfix |
firefox111 | --- | wontfix |
firefox112 | --- | wontfix |
People
(Reporter: tdulcet, Unassigned)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
125.45 KB,
image/png
|
Details |
Steps to reproduce:
- Create a context menu item with lots of white space:
browser.menus.create({
title: " lots of white space "
});
Expected result:
White space is preserved.
Actual result:
White space is collapsed.
This worked as expected in Firefox 108 and before, but broke in Firefox 109. Regression range from mozregression: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=efbd04cb07486419679cf588ba6095f7ef9edef6&tochange=439eb32c377831956882142acdc81b182ba2145b. Bug 1799460 looks most likely. Another regression of that is bug 1801172, which is very similar to this.
The attached screenshot is from my Link Creator add-on, which uses leading white space to indent some menu items for readability.
Reporter | ||
Updated•2 years ago
|
Comment 1•2 years ago
|
||
Set release status flags based on info from the regressing bug 1799460
:emilio, since you are the author of the regressor, bug 1799460, could you take a look? Also, could you set the severity field?
For more information, please visit auto_nag documentation.
Comment 2•2 years ago
•
|
||
It shouldn't be collapsed if you use non-breaking spaces right? So, " in New Tab".replaceAll(" ", "\xa0");
or so.
This seems slightly tricky to fix, because we really want these not to wrap (and unlike the bookmark items which can't have newlines, these can), and to crop the end if they are too long, and there's no easy way in CSS to do "don't break newlines, but preserve spaces". We could implement a hack to replace spaces for non breaking spaces internally, but I'd rather not.
So I'd prefer to keep the current behavior, if using non-breaking spaces is a possibility?
Comment 3•2 years ago
|
||
I just realized that css-text-4 would provide a way of doing this, filed bug 1816899 to track that. But for now non-breaking spaces would be preferable (and more future-proof).
Comment 4•2 years ago
|
||
I guess we could also do this at the web-extensions API level (doing something like that replaceAll
...). If you insist I might go for that solution for now.
Reporter | ||
Comment 5•2 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #2)
It shouldn't be collapsed if you use non-breaking spaces right? So,
" in New Tab".replaceAll(" ", "\xa0");
or so.
Yes, I just updated my local copy of the extension to use non-breaking spaces and it does now seem to work as expected. However, this is still a regression in behavior from all previous versions of Firefox (from before 109) and is likely breaking other add-ons. It is also now a difference in behavior from Chrome.
I guess we could also do this at the web-extensions API level (doing something like that
replaceAll
...).
Add-ons might be using white space characters other than a space (i.e. a tab), so maybe something like this instead:
.replaceAll(/\s/ug, "\u00A0")
.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Description
•