Skip to content

[menu-panel] Menu key handler for "Escape" does not work when inside modal dialog #2113

Description

@justvanrossum

I have a modal dialog that contains a popup menu ("Add source" dialog in https://github.com/googlefonts/fontra/pull/2102, eg. the plust button below the glyph sources list). When using the popup menu, typing escape dismisses the dialog instead of the just the menu.

Possible cause:

  • menu-panel uses a key event handler attached to the window, and dispatches a custom event
  • the dialog has its own key even handler, which takes precedence over the menu-panel handler

If this is correct, the custom event dispatching mechanism of menu-panel is flawed: it cannot cooperate correctly in nested contexts such as these.

@giovanniTramonto, do you remember why you used a custom event in the first place?

https://github.com/googlefonts/fontra/blob/dd37f6752eb9da5854494b835b9d332d0e155813/src-js/fontra-webcomponents/src/menu-panel.js#L468-L472

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions