Skip to content

Switch control renders empty aria-label #13144

@duygu-rmdn

Description

@duygu-rmdn

Bug Description

Hi colleagues,
I notice that the aria-label attribute for the Switch control is derived from the ariaLabelText property.
However, sometimes the property is empty string, so aria attribute is displayed with empty value.
According to accessibility requirements (ACC-264), interactive controls must have a non-empty accessible name.
A possible fix would be to conditionally render the attribute only when a value is provided: aria-label={this.ariaLabelText || undefined}
Could you please take a look?

Affected Component

Switch

Expected Behaviour

Attributes with empty values should not be rendered.

Isolated Example

https://ui5.github.io/webcomponents/play/#eNq9UsFu2zAM_RVVpzaIovUwoHCVYli3Xjeg7aGAL4rE1OpkyrDkZEGQfy-lOIWLFthtkAGZj-Ij-cg9d2jh76JJrefVnqNugVdTcM5NwASYCFZnQrDO691zHwa0Yh28ZULc1KjOfvy6fXj6_ZPloAzkm3mNz8uaA9acsHxUA9rSP6NPxbTzkI1ZhSGdVxbWDsFesD1h1sWcqmIYEK4JOOT4wl_869AbsMIEH3qh7csQ07u3TMkT__9Pp1pImplG9xESKfD4cCeuigijKwtN-MbBtgt9qjkbZSZw62xqlhY2zoAoxpw5dMlpL6LRHpaXiy8jWXKJct7rtvOg5NEileUos1oFu2OlMCJeafNnHF3po2Ib3Z8LEXX3_c11mz0X14X_s4ELwHHo5B_cVxG3LpnmRsmJ8XnoMYwGYXrXJZZ2Xa6qDXbwQArE3mRTO1y8RMpPipaHpaHcyLGzccH-URo_zE9Uk8U-IdOtlrMpT-MssJms0bV5MKzmCzlxx6HLcCmQJv8xttTwLv4b6SK3sDKBEKScUdKyJXlfpDoy8cPhFUZAOpI

Steps to Reproduce

  1. Open the provided sample
  2. Inspect the control
  3. In Accessibility tab, notice the property with empty value

Log Output, Stack Trace or Screenshots

No response

Priority

None

UI5 Web Components Version

2.19

Browser

Chrome

Operating System

No response

Additional Context

No response

Organization

No response

Declaration

  • I’m not disclosing any internal or sensitive information.

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

New Issues

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions