mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-28 20:29:03 +00:00
LibWeb: Implement element-referencing ARIA attributes
There are ARIA attributes, e.g. ariaControlsElements, which refer to a list of elements by their ID. For example: <div aria-controls="item1 item2"> The div.ariaControlsElements attribute would be a list of elements whose ID matches the values in the aria-controls attribute.
This commit is contained in:
parent
0289df9357
commit
f985ac8884
Notes:
github-actions[bot]
2025-04-25 00:21:23 +00:00
Author: https://github.com/trflynn89
Commit: f985ac8884
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4460
Reviewed-by: https://github.com/tcl3 ✅
9 changed files with 3354 additions and 28 deletions
|
@ -15,6 +15,15 @@
|
|||
|
||||
namespace Web::ARIA {
|
||||
|
||||
#define ENUMERATE_ARIA_ELEMENT_LIST_REFERENCING_ATTRIBUTES \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_controls_elements, aria_controls) \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_described_by_elements, aria_described_by) \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_details_elements, aria_details) \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_error_message_elements, aria_error_message) \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_flow_to_elements, aria_flow_to) \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_labelled_by_elements, aria_labelled_by) \
|
||||
__ENUMERATE_ARIA_ATTRIBUTE(aria_owns_elements, aria_owns)
|
||||
|
||||
class ARIAMixin {
|
||||
public:
|
||||
virtual ~ARIAMixin();
|
||||
|
@ -51,6 +60,12 @@ public:
|
|||
GC::Ptr<DOM::Element> aria_active_descendant_element() { return m_aria_active_descendant_element; }
|
||||
void set_aria_active_descendant_element(GC::Ptr<DOM::Element> value) { m_aria_active_descendant_element = value; }
|
||||
|
||||
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
|
||||
Optional<Vector<WeakPtr<DOM::Element>>> const& attribute() const; \
|
||||
void set_##attribute(Optional<Vector<WeakPtr<DOM::Element>>> value);
|
||||
ENUMERATE_ARIA_ELEMENT_LIST_REFERENCING_ATTRIBUTES
|
||||
#undef __ENUMERATE_ARIA_ATTRIBUTE
|
||||
|
||||
protected:
|
||||
ARIAMixin();
|
||||
|
||||
|
@ -60,6 +75,11 @@ protected:
|
|||
|
||||
private:
|
||||
GC::Ptr<DOM::Element> m_aria_active_descendant_element;
|
||||
|
||||
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
|
||||
Optional<Vector<WeakPtr<DOM::Element>>> m_##attribute;
|
||||
ENUMERATE_ARIA_ELEMENT_LIST_REFERENCING_ATTRIBUTES
|
||||
#undef __ENUMERATE_ARIA_ATTRIBUTE
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue