Popovers doesn’t allow overriding onEscapePressed
Bug #1546677 reported by
Olivier Tilloy
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ubuntu-ui-toolkit (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
With the fix for bug #1523828, popovers are automatically closed when ESC is pressed. This is a good default behaviour, however the implementation is unfortunate: because the escapePressed handler is defined on the foreground (a child item of the root popover), app developers don’t get a chance to override it.
Here’s a concrete use case: in the browser, when bookmarking a page with Ctrl+D, a popover with bookmark options is shown. We want the Enter key to validate the options and save the bookmark, and the ESC key to remove the bookmark.
Related branches
lp:~osomon/webbrowser-app/workaround-popover-esc
- PS Jenkins bot: Needs Fixing (continuous-integration)
- Ubuntu Phablet Team: Pending requested
-
Diff: 76 lines (+17/-12)2 files modifiedsrc/app/webbrowser/BookmarkOptions.qml (+2/-2)
src/app/webbrowser/Browser.qml (+15/-10)
Changed in ubuntu-ui-toolkit (Ubuntu): | |
status: | New → Incomplete |
Changed in ubuntu-ui-toolkit (Ubuntu): | |
status: | Expired → Confirmed |
To post a comment you must log in.
I suppose this could be fixed in at least a couple of ways:
- implementing the escapePressed handler on the top-level Popover element, instead of on its foreground child (I just did a quick test and it seems that in this case, if overriden, both the original handler and the override are called, not sure whether that’s intended or a bug in QML, but in any case that would work for our use case)
- adding a cancel() or escape() signal on the popover which would be emitted when ESC is pressed, thus allowing embedders to do specific processing, while keeping the default behaviour of closing the popover