Skip to content

update Bubble classes aria #9661

@maribethb

Description

@maribethb

Check for duplicates

  • I have searched for similar issues before opening a new one.

Problem

No response

Request

Update Bubble class

Bubble will be updated with two new API changes:

/**
 * Recomputes the ARIA label and role for this bubble. This is automatically called
 * during initialization, but implementations may find it useful to call this if
 * the bubble's label should be changed.
 */
protected updateAriaContext()

/**
 * Returns the ARIA label to use for this bubble (defaults to null). Note that this
 * method will only be called during initialization by default, so dynamic changes
 * to the bubble's ARIA label need to be applied by calling updateAriaContext.
 *
 * @returns The ARIA label to use for this bubble, or null to use a default.
 */
protected getAriaLabel(): string | null

The documentation strings explain the contracts of these methods but it's expected that implementations will only ever need to implement getAriaLabel.

All bubbles are treated as role group unless updateAriaContext is overridden. The focusable element's label is set to the result of getAriaLabel only if it's non-null. If it's null then a default 'Bubble' text will be used, instead, to ensure that some human-readable label is used.

Update use of Bubble classes

The specific bubbles we use in core need to be updated to have the following default labels (with translation support):
MiniWorkspaceBubble: 'Mutator Bubble' (note this name is subject to debate and open to suggestions for a better user-facing name here)
TextBubble: 'Warning Bubble'
TextInputBubble: 'Comment Bubble'

However, I don't think it makes sense to update the default label to all TextBubbles to be Warning Bubble for example. It would make more sense for the owning WarningIcon to set the label for the text bubble that it controls. I think this implies that Bubbles need a setAriaLabel method as well. Do not implement this part of this feature request until thIs comment is resolved. https://docs.google.com/document/d/1-q0paWfV9qYWoZKWb9BpcfYOy3xYZtvcLyuuD61qHXw/edit?disco=AAAB2l5ws30

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue: feature requestDescribes a new feature and why it should be addedissue: triageIssues awaiting triage by a Blockly team member

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions