mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Allow focusable for the first summary child of a detail element
This commit is contained in:
parent
8ca59e7c7e
commit
bd56fdc57b
Notes:
github-actions[bot]
2025-11-12 12:58:07 +00:00
Author: https://github.com/lpas
Commit: bd56fdc57b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6780
Reviewed-by: https://github.com/gmta ✅
3 changed files with 13 additions and 5 deletions
|
|
@ -41,7 +41,7 @@ void HTMLSummaryElement::activation_behavior(DOM::Event const&)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interactive-elements.html#summary-for-its-parent-details
|
||||
bool HTMLSummaryElement::is_summary_for_its_parent_details()
|
||||
bool HTMLSummaryElement::is_summary_for_its_parent_details() const
|
||||
{
|
||||
// A summary element is a summary for its parent details if the following algorithm returns true:
|
||||
|
||||
|
|
@ -64,6 +64,13 @@ bool HTMLSummaryElement::is_summary_for_its_parent_details()
|
|||
return true;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#the-tabindex-attribute:the-summary-element
|
||||
bool HTMLSummaryElement::is_focusable() const
|
||||
{
|
||||
// summary elements that are the first summary element child of a details element
|
||||
return Base::is_focusable() || is_summary_for_its_parent_details();
|
||||
}
|
||||
|
||||
HTMLSummaryElement::~HTMLSummaryElement() = default;
|
||||
|
||||
void HTMLSummaryElement::initialize(JS::Realm& realm)
|
||||
|
|
|
|||
|
|
@ -21,10 +21,11 @@ public:
|
|||
// https://www.w3.org/TR/html-aria/#el-details
|
||||
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::button; }
|
||||
|
||||
bool is_summary_for_its_parent_details();
|
||||
bool is_summary_for_its_parent_details() const;
|
||||
|
||||
virtual bool has_activation_behavior() const override;
|
||||
virtual void activation_behavior(DOM::Event const&) override;
|
||||
virtual bool is_focusable() const override;
|
||||
|
||||
private:
|
||||
HTMLSummaryElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue