Procházet zdrojové kódy

LibWeb: Add support for the “mark” ARIA role

sideshowbarker před 7 měsíci
rodič
revize
6e24f23aa0

+ 42 - 0
Libraries/LibWeb/ARIA/AriaRoles.json

@@ -3307,6 +3307,48 @@
     "childrenArePresentational": false,
     "implicitValueForRole": {}
   },
+  "Mark": {
+    "specLink": "https://w3c.github.io/aria/#mark",
+    "description": "Content which is marked or highlighted for reference or notation purposes, due to the content's relevance in the enclosing context.",
+    "superClassRoles": [
+      "Section"
+    ],
+    "supportedStates": [
+      "aria-busy",
+      "aria-current",
+      "aria-disabled",
+      "aria-grabbed",
+      "aria-hidden",
+      "aria-invalid"
+    ],
+    "supportedProperties": [
+      "aria-atomic",
+      "aria-brailleroledescription",
+      "aria-controls",
+      "aria-describedby",
+      "aria-description",
+      "aria-details",
+      "aria-dropeffect",
+      "aria-errormessage",
+      "aria-flowto",
+      "aria-haspopup",
+      "aria-keyshortcuts",
+      "aria-live",
+      "aria-owns",
+      "aria-relevant",
+      "aria-roledescription"
+    ],
+    "requiredStates": [],
+    "requiredProperties": [],
+    "prohibitedStates": [],
+    "prohibitedProperties": [],
+    "requiredContextRoles": [],
+    "requiredOwnedElements": [],
+    "nameFromSource": "Prohibited",
+    "accessibleNameRequired": false,
+    "childrenArePresentational": false,
+    "implicitValueForRole": {}
+  },
   "Navigation": {
     "specLink": "https://www.w3.org/TR/wai-aria-1.2/#navigation",
     "description": "A landmark containing a collection of navigational elements (usually links) for navigating the document or related documents.",

+ 2 - 0
Libraries/LibWeb/ARIA/RoleType.cpp

@@ -232,6 +232,8 @@ ErrorOr<NonnullOwnPtr<RoleType>> RoleType::build_role_object(Role role, bool foc
         return adopt_nonnull_own_or_enomem(new (nothrow) Main(data));
     case Role::marquee:
         return adopt_nonnull_own_or_enomem(new (nothrow) Marquee(data));
+    case Role::mark:
+        return adopt_nonnull_own_or_enomem(new (nothrow) Mark(data));
     case Role::math:
         return adopt_nonnull_own_or_enomem(new (nothrow) Math(data));
     case Role::meter:

+ 1 - 0
Libraries/LibWeb/ARIA/Roles.h

@@ -53,6 +53,7 @@ namespace Web::ARIA {
     __ENUMERATE_ARIA_ROLE(listitem)         \
     __ENUMERATE_ARIA_ROLE(log)              \
     __ENUMERATE_ARIA_ROLE(main)             \
+    __ENUMERATE_ARIA_ROLE(mark)             \
     __ENUMERATE_ARIA_ROLE(marquee)          \
     __ENUMERATE_ARIA_ROLE(math)             \
     __ENUMERATE_ARIA_ROLE(meter)            \

+ 3 - 0
Libraries/LibWeb/HTML/HTMLElement.cpp

@@ -776,6 +776,9 @@ Optional<ARIA::Role> HTMLElement::default_role() const
     // https://www.w3.org/TR/html-aria/#el-main
     if (local_name() == TagNames::main)
         return ARIA::Role::main;
+    // https://www.w3.org/TR/html-aria/#el-mark
+    if (local_name() == TagNames::mark)
+        return ARIA::Role::mark;
     // https://www.w3.org/TR/html-aria/#el-nav
     if (local_name() == TagNames::nav)
         return ARIA::Role::navigation;