Skip to content

aria-invalid:spelling/grammar is not mapped correctly on macOS #254

Open

Description

@ffiori

I'm currently working on AX support for CSS Custom Highlights on chromium and saw that there's no support for grammar errors on macOS (or at least I couldn't manage to make VoiceOver announce grammar errors in any app, please correct me if this is not the case).

In the codebase there's no mapping for aria-invalid from AXInvalid to 'spelling' or 'grammar' like in other platforms (UIA, IA2 and Linux correctly use those). Spelling errors are mapped to text attribute NSAccessibilityMarkedMisspelledTextAttribute, while grammar errors are not supported at all (I haven't found a similar text attribute to the spelling one either).

I tried modifying the code in chromium to map those to AXInvalid:'spelling' or 'grammar' but it's not recognized by VoiceOver.

Probably we should update CoreAAM docs? Or I'm not sure if this is something that's pending on macOS?

@cookiecrook any thoughts on this?

cc @benbeaudry

Activity

  1. benbeaudry commented on Oct 28, 2025

    @benbeaudry
    Contributor

    Thanks for filing, @ffiori! I just did some more testing with Safari and noticed the following:

    1. aria-invalid=grammar/spelling/true is announced when aria-invalid is set directly on the textbox element (and not the text children). Example: <div contenteditable aria-invalid="grammar">This are a dog</div>
    2. aria-invalid=grammar/spelling/true is not announced when set on a text child of a textbox element. Example: <div contenteditable>This <span aria-invalid="grammar">are</span> a dog</div>

    This changes my initial opinion that the Core-AAM spec for aria-invalid on AX API is incorrect. It sounds accurate to me.

    I also found this interesting:

    This state is being deprecated as a global state in ARIA 1.2. In future versions it will only be allowed on roles where it is specifically supported. link

    As of ARIA 1.2, the supported roles are application, checkbox, combobox, gridcell, listbox, radiogroup, slider, spinbutton, textbox, and tree. Note that textual roles (like heading, for example) aren't included in the list, so it feels like this behavior is by design.

    However, it seems like Core-AAM is lacking a mapping to NSAccessibilityMarkedMisspelledTextAttribute (as you called out). Both Safari and Chromium implement it, and it should be reflected in the standards.

    @cookiecrook, can you/someone on the VoiceOver team confirm the following:

    1. NSAccessibilityMarkedMisspelledTextAttribute should appear somewhere in Core-AAM.
    2. The AX API currently doesn't have an equivalent "NSAccessibilityMarkedGrammarTextAttribute", but to be consistent with the spelling errors, maybe it should?
    3. Safari currently doesn't support accessible CSS highlights.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions