Skip to content

Update Icon aria #9662

@maribethb

Description

@maribethb

Check for duplicates

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

Problem

No response

Request

Icon (not IIcon since these are default implemented methods) will be updated with the following API changes:

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

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

This follows the same design strategy as Bubbles including defaulting the label to 'Icon' if no override is provided. By default, Icons are given the role button as it best fits their interactive nature. Specific icons will have support implemented:

  • MutatorIcon
    • getAriaLabel: return a localized 'Close Mutator' or 'Open Mutator' based on whether the bubble is visible.
    • Call updateAriaContext at the end of setBubbleVisible.
  • WarningIcon
    • getAriaLabel: return a localized 'Close Warning' or 'Open Warning' based on whether the bubble is visible.
    • Call updateAriaContext at the end of setBubbleVisible.
  • CommentIcon
    • getAriaLabel: return a localized 'Close Comment' or 'Open Comment' based on whether the bubble is visible.
    • Call updateAriaContext at the end of setBubbleVisible.

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExternal contributions actively solicitedissue: feature requestDescribes a new feature and why it should be addedissue: triageIssues awaiting triage by a Blockly team member

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions