Skip to content

Feat(web-react,web-twig): Remove aria-selected from Item #DS-1851 #2023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions packages/web-react/src/components/Item/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,7 @@ const Item = <T extends ElementType = 'button'>(props: SpiritItemProps<T>): JSX.
const mergedStyleProps = mergeStyleProps(ElementTag, { classProps: classProps.root, styleProps, otherProps });

return (
<ElementTag
{...otherProps}
{...mergedStyleProps}
aria-selected={!!isSelected}
disabled={!!isDisabled && ElementTag === 'button'}
>
<ElementTag {...otherProps} {...mergedStyleProps} disabled={!!isDisabled && ElementTag === 'button'}>
{iconName && (
<span className={classNames(classProps.icon.root, classProps.icon.start)}>
<Icon name={iconName} />
Expand Down
2 changes: 0 additions & 2 deletions packages/web-twig/src/Resources/components/Item/Item.twig
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
{%- set _labelClassName = _spiritClassPrefix ~ 'Item__label' -%}

{# Attributes #}
{%- set _ariaSelectedAttr = 'aria-selected="' ~ (_isSelected ? 'true' : 'false') ~ '"' -%}
{%- set _buttonDisabledAttr = (_elementType == 'button' and _isDisabled) ? 'disabled' : null -%}
{%- set _hrefAttr = (_elementType == 'a' and _href) ? 'href=' ~ _href : null -%}
{%- set _targetAttr = (_elementType == 'a' and _target) ? 'target=' ~ _target | escape('html_attr') : null -%}
Expand All @@ -42,7 +41,6 @@
{{ _targetAttr }}
{{ _typeAttr }}
{{ _buttonDisabledAttr }}
{{ _ariaSelectedAttr | raw }}
>
{% if _iconName %}
<span class="{{ _startIconClassName }}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
</title>
</head>
<body>
<button class="Item" type="button" aria-selected="false"><span class="Item__label">Item label</span></button>
<a class="Item" href="https://www.example.com/" aria-selected="false"><span class="Item__label">Item
label</span></a>
<div class="Item" aria-selected="false">
<button class="Item" type="button"><span class="Item__label">Item label</span></button> <a class="Item" href="https://www.example.com/"><span class="Item__label">Item label</span></a>
<div class="Item">
<span class="Item__label">Item label</span>
</div>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</title>
</head>
<body>
<button class="Item Item--disabled" type="button" disabled aria-selected="false"><span class="Item__label">Item label</span></button> <a class="Item Item--disabled" aria-selected="false"><span class="Item__label">Item label</span></a>
<button class="Item Item--disabled" type="button" disabled><span class="Item__label">Item
label</span></button> <a class="Item Item--disabled"><span class="Item__label">Item label</span></a>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
</title>
</head>
<body>
<button class="Item" type="button" aria-selected="false"><span class="Item__label">Item label</span> <span class="Item__helperText">Helper text</span></button>
<button class="Item" type="button"><span class="Item__label">Item label</span> <span class="Item__helperText">Helper text</span></button>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</title>
</head>
<body>
<button class="Item" type="button" aria-selected="false"><span class="Item__icon Item__icon--start"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none" class="Icon" aria-hidden="true">
<button class="Item" type="button"><span class="Item__icon Item__icon--start"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none" class="Icon" aria-hidden="true">
<path d="M15.5 14H14.71L14.43 13.73C15.63 12.33 16.25 10.42 15.91 8.39002C15.44 5.61002 13.12 3.39002 10.32 3.05002C6.09001 2.53002 2.53002 6.09001 3.05002 10.32C3.39002 13.12 5.61002 15.44 8.39002 15.91C10.42 16.25 12.33 15.63 13.73 14.43L14 14.71V15.5L18.25 19.75C18.66 20.16 19.33 20.16 19.74 19.75C20.15 19.34 20.15 18.67 19.74 18.26L15.5 14ZM9.50002 14C7.01002 14 5.00002 11.99 5.00002 9.50002C5.00002 7.01002 7.01002 5.00002 9.50002 5.00002C11.99 5.00002 14 7.01002 14 9.50002C14 11.99 11.99 14 9.50002 14Z" fill="currentColor">
</path></svg></span> <span class="Item__label">Item label</span></button>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
</title>
</head>
<body>
<button class="Item Item--selected" type="button" aria-selected="true"><span class="Item__label">Item label</span>
<span class="Item__icon Item__icon--end"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none" class="Icon" aria-hidden="true">
<button class="Item Item--selected" type="button"><span class="Item__label">Item label</span> <span class="Item__icon Item__icon--end"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24" fill="none" class="Icon" aria-hidden="true">
<path d="M9.00012 16.5448L5.50012 13.0448C5.11012 12.6548 4.49012 12.6548 4.10012 13.0448C3.71012 13.4348 3.71012 14.0548 4.10012 14.4448L8.29012 18.6348C8.68012 19.0248 9.31012 19.0248 9.70012 18.6348L20.3001 8.04479C20.6901 7.65479 20.6901 7.03479 20.3001 6.64479C19.9101 6.25479 19.2901 6.25479 18.9001 6.64479L9.00012 16.5448Z" fill="currentColor">
</path></svg></span></button>
</body>
Expand Down
Loading