Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/fix-stale-dropdown-triggers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siemens/ix': patch
---

Prevent outdated asynchronous dropdown triggers from attaching listeners or changing submenu state after the trigger changes or the dropdown is disconnected. Clean up trigger listeners on disconnect and restore them on reconnect.
5 changes: 5 additions & 0 deletions .changeset/fresh-buttons-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siemens/ix': patch
---

Forward updated and removed ARIA attributes to each component's accessible element without leaving invalid host copies. `ix-toggle` now keeps its component managed attributes (`role`, `aria-checked`, `aria-disabled`, `aria-required`) intact while still accepting custom ARIA attributes such as `aria-label`.
Comment thread
nuke-ellington marked this conversation as resolved.
Resolved
8 changes: 8 additions & 0 deletions .changeset/mighty-poems-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
'@siemens/ix': patch
---

Fixed `ix-dropdown` trigger handling: an empty `trigger` value no longer matches
elements without an `id`, changing the trigger to an empty value now removes the
previously registered listeners, and asynchronously resolved triggers that became
stale are discarded instead of attaching orphaned listeners.
Comment thread
lzeiml marked this conversation as resolved.
Resolved
5 changes: 5 additions & 0 deletions .changeset/persistent-pinned-menu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siemens/ix': patch
---

Keep pinned `ix-menu` components expanded when a menu item is selected.
5 changes: 5 additions & 0 deletions .changeset/reliable-tab-activation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siemens/ix': patch
---

Fix `ix-tab-set` panel activation and `ix-menu-about` tab activation when child components are still initializing.
5 changes: 5 additions & 0 deletions .changeset/stable-date-picker-focus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siemens/ix': patch
---

Fix `ix-date-picker` keyboard navigation so focus consistently moves to the expected day.
5 changes: 5 additions & 0 deletions .changeset/steady-dropdown-triggers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@siemens/ix': patch
---

Fix `ix-dropdown` trigger initialization so dropdowns open reliably immediately after rendering or when triggers are added dynamically.
14 changes: 6 additions & 8 deletions packages/core/src/components/badge/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,22 +218,20 @@ export class Badge

private hasDisconnected = false;

override keepAriaAttributesOnHost(): boolean {
return !this.hasAnchor;
}

override componentWillLoad() {
// Mixin strips host ARIA into `inheritAriaAttributes` and removes them from the host.
this.hasAnchor = this.detectHasAnchor();
super.componentWillLoad();
this.descriptionId = `${this.getHostElementId()}-description`;
const hasAnchor = this.detectHasAnchor();

if (hasAnchor) {
this.hasAnchor = true;
if (this.hasAnchor) {
// Attached: discard host ARIA โ€” the anchor owns naming; the indicator is decorative
// (`aria-hidden`) and count/label text is exposed via `aria-describedby` on the anchor.
this.inheritAriaAttributes = {};
return;
}

this.hasAnchor = false;
// Standalone: keep mixin-captured ARIA and re-apply on `<Host>` in `render()`.
}

override componentDidLoad() {
Expand Down
47 changes: 47 additions & 0 deletions packages/core/src/components/badge/test/badge.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,53 @@ regressionTest.describe('ix-badge', () => {
});
}
);

regressionTest(
'updates and removes standalone host ARIA',
async ({ mount, page }) => {
await mount(
`<ix-badge type="dot" role="img" aria-label="Unread"></ix-badge>`
);
const badge = page.locator('ix-badge');
await expect(badge).toHaveClass(/\bhydrated\b/);

await badge.evaluate((element) => {
element.setAttribute('aria-label', 'Read');
element.setAttribute('role', 'status');
});
await expect(page.getByRole('status', { name: 'Read' })).toBeVisible();

await badge.evaluate((element) => {
element.removeAttribute('aria-label');
element.removeAttribute('role');
});
await expect(badge).not.toHaveAttribute('aria-label');
await expect(badge).not.toHaveAttribute('role');
}
);

regressionTest(
'preserves standalone host ARIA after reconnect',
async ({ mount, page }) => {
await mount(
`<ix-badge type="dot" role="img" aria-label="Unread"></ix-badge>`
);
const badge = page.locator('ix-badge');
await expect(badge).toHaveClass(/\bhydrated\b/);
await expect(page.getByRole('img', { name: 'Unread' })).toBeVisible();

await badge.evaluate((element) => {
const parent = element.parentElement;
if (!parent) {
throw new Error('Badge must have a parent before reconnecting');
}
element.remove();
parent.appendChild(element);
});

await expect(page.getByRole('img', { name: 'Unread' })).toBeVisible();
}
);
});

regressionTest.describe('tooltip', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ regressionTest(
await expect(
chatInput.locator('ix-dropdown-button.attachment-overflow')
).toHaveCount(0);
await expect(chatInput.locator('.attachments')).not.toHaveClass(
/has-attachment-scrollbar/
);
await expect(
page.locator('[data-attachment-overflow-generated]')
).toHaveCount(0);
Expand Down
46 changes: 24 additions & 22 deletions packages/core/src/components/checkbox/tests/checkbox.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ regressionTest(
const checkbox = page.locator('ix-checkbox');
await expect(checkbox).not.toHaveClass(/label-less/);
await expect(checkbox).toHaveText(/Custom slot label text/);
await expect(checkbox.locator('ix-typography')).toBeVisible();
await expect
.poll(() =>
checkbox.evaluate((element) =>
Expand All @@ -131,37 +132,38 @@ regressionTest('label', async ({ mount, page }) => {
await expect(checkboxElement).toHaveText(/some label/);
});

test('Checkbox should not cause layout shift when checked', async ({
mount,
page,
}) => {
await mount(`
regressionTest(
'Checkbox should not cause layout shift when checked',
async ({ mount, page }) => {
await mount(`
<ix-checkbox label="test"></ix-checkbox>
<div id="element-below">This element should not move</div>
`);

await page.waitForSelector('ix-checkbox', { state: 'attached' });
const checkbox = page.locator('ix-checkbox');
const elementBelow = page.locator('#element-below');

const initialBounds = await page.$eval('#element-below', (el) => {
const rect = el.getBoundingClientRect();
return { top: rect.top, left: rect.left };
});
await expect(checkbox).toHaveClass(/hydrated/);
await expect(elementBelow).toBeVisible();
await page.evaluate(() => document.fonts.ready);

await page.click('ix-checkbox');
const initialBounds = await elementBelow.boundingBox();
if (!initialBounds) {
throw new Error('Expected element below checkbox to have a bounding box');
}

await page.waitForFunction(() => {
const checkbox = document.querySelector('ix-checkbox');
return checkbox?.getAttribute('aria-checked') === 'true';
});
await checkbox.click();
await expect(checkbox).toHaveAttribute('aria-checked', 'true');

const newBounds = await page.$eval('#element-below', (el) => {
const rect = el.getBoundingClientRect();
return { top: rect.top, left: rect.left };
});
const newBounds = await elementBelow.boundingBox();
if (!newBounds) {
throw new Error('Expected element below checkbox to remain visible');
}

expect(newBounds.top).toBeCloseTo(initialBounds.top, 0);
expect(newBounds.left).toBeCloseTo(initialBounds.left, 0);
});
expect(newBounds.y).toBeCloseTo(initialBounds.y, 0);
expect(newBounds.x).toBeCloseTo(initialBounds.x, 0);
}
);

test.describe('accessibility', () => {
test('should expose aria-label for accessibility queries', async ({
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/components/chip/test/chip.ct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@ regressionTest(
await expect(
page.getByRole('button', { name: 'Close chip' })
).toBeVisible();

await chip.evaluate((element) => {
element.setAttribute('aria-label', 'Project Beta');
});

await expect(chip).not.toHaveAttribute('aria-label');
await expect(
page.getByRole('button', { name: 'Project Beta' })
).toBeVisible();
await expect(chip).toHaveAttribute('role', 'group');
}
);

Expand Down
18 changes: 15 additions & 3 deletions packages/core/src/components/date-picker/date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ export class DatePicker
break;
}

event.preventDefault();
return;
}

Expand Down Expand Up @@ -742,7 +743,18 @@ export class DatePicker
return rows;
}

public changeFocusedDay() {
public changeFocusedDay(focusTarget?: EventTarget) {
const focusedDayElement =
focusTarget instanceof HTMLElement
? focusTarget.closest<HTMLElement>('[data-calendar-day]')
: null;
const focusedDay = focusedDayElement?.dataset.calendarDay;

if (focusedDay) {
this.focusedDay = Number.parseInt(focusedDay, 10);
return;
}

if (this.monthChangedFromFocus) {
return;
}
Expand Down Expand Up @@ -827,9 +839,9 @@ export class DatePicker
return (
<Host
onKeyDown={(event: KeyboardEvent) => this.onKeyDown(event)}
onFocusin={() => {
onFocusin={(event: FocusEvent) => {
if (hasKeyboardMode()) {
this.changeFocusedDay();
this.changeFocusedDay(event.composedPath()[0]);
}
}}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1450,8 +1450,14 @@ regressionTest('form-ready - initial value', async ({ mount, page }) => {
const formElement = page.locator('form');
preventFormSubmission(formElement);

const formData = await getFormValue(formElement, 'appointment-time', page);
expect(formData).toBe('2024/12/25 10:00:00');
const dateTimeInput = page.locator('ix-datetime-input');
await expect(dateTimeInput).toHaveClass(/hydrated/);
await expect(dateTimeInput.getByRole('textbox')).toHaveValue(
'2024/12/25 10:00:00'
);
await expect
.poll(() => getFormValue(formElement, 'appointment-time', page))
.toBe('2024/12/25 10:00:00');
});

regressionTest(
Expand Down
30 changes: 29 additions & 1 deletion packages/core/src/components/dropdown/dropdown-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export interface DropdownInterface extends IxComponentInterface {

getAssignedSubmenuIds(): string[];
getId(): string;
matchesTrigger(eventTargets: EventTarget[]): boolean;
getTriggerElement(): HTMLElement | undefined;

discoverSubmenu(): void;
Expand Down Expand Up @@ -53,6 +54,28 @@ export interface DropdownItemWrapper {
}

export class DropdownController {
private readonly onWindowClick = (event: MouseEvent) => {
const eventTargets = event.composedPath();
if (this.pathIncludesTrigger(eventTargets) || event.defaultPrevented) {
return;
}

for (const id of this.registry.keys()) {
const dropdown = this.registry.get(id);
if (!dropdown?.matchesTrigger(eventTargets)) {
continue;
}

if (dropdown.isPresent()) {
this.dismiss(dropdown);
} else {
this.present(dropdown);
}
this.dismissOthers(dropdown.getId());
return;
}
};

private readonly registry = new NestedOverlayRegistry<DropdownInterface>(
{
blocksOutsideDismiss: (dropdown) =>
Expand All @@ -66,6 +89,9 @@ export class DropdownController {
) {}

connected(dropdown: DropdownInterface) {
if (this.registry.keys().length === 0) {
window.addEventListener('click', this.onWindowClick);
}
this.registry.connect(dropdown);
this.overlayCoordinator.connect({
key: this.getOverlayKey(dropdown),
Expand All @@ -91,6 +117,9 @@ export class DropdownController {
disconnected(dropdown: DropdownInterface) {
this.registry.disconnect(dropdown);
this.overlayCoordinator.disconnect(this.getOverlayKey(dropdown));
if (this.registry.keys().length === 0) {
window.removeEventListener('click', this.onWindowClick);
}
}

removeFromSubmenuIds(id: string) {
Expand Down Expand Up @@ -204,7 +233,6 @@ export class DropdownController {
this.overlayCoordinator.pathIncludesDescendant(key, eventTargets)
);
}

getParentFocusExitTarget(
dropdown: DropdownInterface,
current: HTMLElement,
Expand Down
Loading