mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 07:41:51 +08:00
fix(breadcrumb): add aria-label to collapsed indicator (#26615)
This commit is contained in:
@ -212,13 +212,14 @@ export class Breadcrumb implements ComponentInterface {
|
||||
{showCollapsedIndicator && (
|
||||
<button
|
||||
part="collapsed-indicator"
|
||||
aria-label="Show more breadcrumbs"
|
||||
onClick={() => this.collapsedIndicatorClick()}
|
||||
ref={(collapsedEl) => (this.collapsedRef = collapsedEl)}
|
||||
class={{
|
||||
'breadcrumbs-collapsed-indicator': true,
|
||||
}}
|
||||
>
|
||||
<ion-icon icon={ellipsisHorizontal} lazy={false}></ion-icon>
|
||||
<ion-icon aria-hidden="true" icon={ellipsisHorizontal} lazy={false}></ion-icon>
|
||||
</button>
|
||||
)}
|
||||
{showSeparator && (
|
||||
|
||||
23
core/src/components/breadcrumb/test/aria.spec.ts
Normal file
23
core/src/components/breadcrumb/test/aria.spec.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { newSpecPage } from '@stencil/core/testing';
|
||||
|
||||
import { Breadcrumb } from '../breadcrumb';
|
||||
|
||||
describe('breadcrumb: collapsed indicator', () => {
|
||||
it('should have an aria-label', async () => {
|
||||
const page = await newSpecPage({
|
||||
components: [Breadcrumb],
|
||||
/**
|
||||
* `showCollapsedIndicator` is an internal API used by `ion-breadcrumbs`.
|
||||
* This test makes use of it to render the collapsed indicator.
|
||||
*/
|
||||
html: `<ion-breadcrumb show-collapsed-indicator="true">Text</ion-breadcrumb>`,
|
||||
});
|
||||
|
||||
const collapsedIndicator = page.body
|
||||
.querySelector('ion-breadcrumb')!
|
||||
.shadowRoot!.querySelector('.breadcrumbs-collapsed-indicator')!;
|
||||
const ariaLabel = collapsedIndicator.getAttribute('aria-label');
|
||||
|
||||
expect(ariaLabel).toEqual('Show more breadcrumbs');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user