LibWeb: Implement popover's close watcher

Auto popovers now correctly establish a close watcher when shown.

This means popovers now correctly close with an escape key press.

Also correctly hide open popovers when removed from the document.
This commit is contained in:
Luke Warlow 2024-12-06 13:05:29 +00:00 committed by Alexander Kalenik
commit 0a02eb639d
Notes: github-actions[bot] 2024-12-17 03:56:49 +00:00
2 changed files with 36 additions and 4 deletions

View file

@ -116,6 +116,8 @@ public:
WebIDL::ExceptionOr<void> set_popover(Optional<String> value);
Optional<String> popover() const;
virtual void removed_from(Node*) override;
enum class PopoverVisibilityState {
Hidden,
Showing,
@ -181,6 +183,9 @@ private:
// https://html.spec.whatwg.org/multipage/popover.html#the-popover-attribute:toggle-task-tracker
Optional<ToggleTaskTracker> m_popover_toggle_task_tracker;
// https://html.spec.whatwg.org/multipage/popover.html#popover-close-watcher
GC::Ptr<CloseWatcher> m_popover_close_watcher;
};
}