Closed Bug 1700732 Opened 4 years ago Closed 4 years ago

Make native menus respect display:none user styles on menu items

Categories

(Core :: Widget: Cocoa, enhancement, P3)

All
macOS
enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: mstange, Unassigned)

References

Details

(Whiteboard: [proton-context-menus][mac:mr1])

Attachments

(1 obsolete file)

This was brought up in bug 34572 comment 29: Some users have custom userChrome CSS in order to hide unneeded items in the page context menu, by setting display:none on the items. Native context menus do not observe these CSS declarations at the moment, so these items are now unexpectedly shown in native context menus.
It's probably easy enough to check the computed display style on the DOM nodes and make this work.

Priority: -- → P3
Attachment #9212635 - Attachment is obsolete: true

I gave this a shot but it looks harder than anticipated.

The problem is that the naive approach breaks dynamic changes to the hidden attribute. [hidden=true] sets display:none. When hidden=true is removed, our AttributeChanged mutation observer calls nsMenuX::ObserveAttributeChanged which checks the new visibility state synchronously during the observer. Querying the computed style at this point still shows cs->StyleDisplay()->mDisplay == StyleDisplay::None. So it looks like the style hasn't yet updated in response to the attribute change, and the item is still treated as hidden even though the hidden attribute has just been removed.

Since this is just a nice-to-have I am not planning to spend more time on it.

Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → WONTFIX

This bug was caught by the test widget/tests/test_standalone_native_menu.xhtml.

Please reconsider, this makes it impossible for me to use the native context menu.

Or at least allow up to deny extensions permission to populate the context menu, that'd be even better as it helps all platforms.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: