Skip to content

fix(searchbar): forward aria-label and aria-labelledby from host to input - #31595

Open
rudrakshagarwal4200-ai wants to merge 1 commit into
ionic-team:mainfrom
rudrakshagarwal4200-ai:rudrakshagarwal4200-ai-patch-5
Open

rudrakshagarwal4200-ai wants to merge 1 commit into
ionic-team:mainfrom
rudrakshagarwal4200-ai:rudrakshagarwal4200-ai-patch-5

Conversation

@rudrakshagarwal4200-ai

Copy link
Copy Markdown

Summary

Fixes #31492.

ion-searchbar previously hardcoded aria-label="search text" on its native <input> element and only inherited ['lang', 'dir'] from the host. As a result, custom aria-label or aria-labelledby attributes placed on <ion-searchbar> were never forwarded to the input, causing screen readers to announce "search text" unconditionally regardless of app localization or search context.

Fix

  1. In componentWillLoad(), merge ...inheritAriaAttributes(this.el) into this.inheritedAttributes so that aria-label and aria-labelledby are forwarded to the native input, consistent with ion-input and ion-textarea.
  2. Keep aria-label="search text" as the default fallback when aria-labelledby is not set on the host, while allowing host aria-label (via spread) or aria-labelledby to take precedence.

@vercel

vercel Bot commented Oct 17, 2026

Copy link
Copy Markdown

@rudrakshagarwal4200-ai is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the package: core @ionic/core package label Oct 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ion-searchbar input is always labelled "search text"; aria-label on the host is not forwarded

1 participant