Skip to content
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
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [9.0.7](https://github.com/ionic-team/ionic-framework/compare/v9.0.6...v9.0.7) (2026-10-07)

### Bug Fixes

* **close-watcher:** allow back navigation when nothing is open ([#31520](https://github.com/ionic-team/ionic-framework/issues/31520)) ([6532bcb](https://github.com/ionic-team/ionic-framework/commit/6532bcbcf5b69f33724a66ab76720ec645adb00b)), closes [#29648](https://github.com/ionic-team/ionic-framework/issues/29648)
* **css:** stop emitting :host-context selectors in global stylesheets ([#31516](https://github.com/ionic-team/ionic-framework/issues/31516)) ([35bd2fa](https://github.com/ionic-team/ionic-framework/commit/35bd2fa9f1046b3f5fd3cd6b3778b0b5945be99c)), closes [#30024](https://github.com/ionic-team/ionic-framework/issues/30024)
* **input-otp:** sync value when length changes ([#31485](https://github.com/ionic-team/ionic-framework/issues/31485)) ([e425825](https://github.com/ionic-team/ionic-framework/commit/e425825815d3c0ab39800912558624b9de72dc6f)), closes [#31484](https://github.com/ionic-team/ionic-framework/issues/31484) [#31484](https://github.com/ionic-team/ionic-framework/issues/31484)
* **react:** prevent error when an outlet unmounts before it's ready ([#31517](https://github.com/ionic-team/ionic-framework/issues/31517)) ([d5bab2e](https://github.com/ionic-team/ionic-framework/commit/d5bab2e89548311b2e3f62b5fe2be477685cb06d)), closes [#31513](https://github.com/ionic-team/ionic-framework/issues/31513)
* **vue-router:** render the redirect target when a guard redirects ([#31510](https://github.com/ionic-team/ionic-framework/issues/31510)) ([643584b](https://github.com/ionic-team/ionic-framework/commit/643584b3ac2ba1ca263cbf53960ccde3be2a96fc))
* **vue-router:** reset tab with memory history ([#31511](https://github.com/ionic-team/ionic-framework/issues/31511)) ([edbc304](https://github.com/ionic-team/ionic-framework/commit/edbc304fbc4179a668d0e170241abd78311fdb62)), closes [#29785](https://github.com/ionic-team/ionic-framework/issues/29785)


## [9.0.6](https://github.com/ionic-team/ionic-framework/compare/v9.0.5...v9.0.6) (2026-09-30)

### Bug Fixes
Expand Down
9 changes: 9 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [9.0.7](https://github.com/ionic-team/ionic-framework/compare/v9.0.6...v9.0.7) (2026-10-07)

### Bug Fixes

* **close-watcher:** allow back navigation when nothing is open ([#31520](https://github.com/ionic-team/ionic-framework/issues/31520)) ([6532bcb](https://github.com/ionic-team/ionic-framework/commit/6532bcbcf5b69f33724a66ab76720ec645adb00b)), closes [#29648](https://github.com/ionic-team/ionic-framework/issues/29648)
* **css:** stop emitting :host-context selectors in global stylesheets ([#31516](https://github.com/ionic-team/ionic-framework/issues/31516)) ([35bd2fa](https://github.com/ionic-team/ionic-framework/commit/35bd2fa9f1046b3f5fd3cd6b3778b0b5945be99c)), closes [#30024](https://github.com/ionic-team/ionic-framework/issues/30024)
* **input-otp:** sync value when length changes ([#31485](https://github.com/ionic-team/ionic-framework/issues/31485)) ([e425825](https://github.com/ionic-team/ionic-framework/commit/e425825815d3c0ab39800912558624b9de72dc6f)), closes [#31484](https://github.com/ionic-team/ionic-framework/issues/31484) [#31484](https://github.com/ionic-team/ionic-framework/issues/31484)


## [9.0.6](https://github.com/ionic-team/ionic-framework/compare/v9.0.5...v9.0.6) (2026-09-30)

**Note:** Version bump only for package @ionic/core
Expand Down
22 changes: 11 additions & 11 deletions core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ionic/core",
"version": "9.0.6",
"version": "9.0.7",
"description": "Base components for Ionic",
"engines": {
"node": ">= 16"
Expand Down
28 changes: 27 additions & 1 deletion core/src/components/input-otp/input-otp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ export class InputOTP implements ComponentInterface {
*/
private isKeyboardNavigation = false;

/**
* The `length` watcher runs before new inputs render, so
* `componentDidRender` updates their tab indexes instead.
*/
private updateTabIndexesAfterRender = false;

@Element() el!: HTMLIonInputOtpElement;

@State() private inputValues: string[] = [];
Expand Down Expand Up @@ -197,6 +203,12 @@ export class InputOTP implements ComponentInterface {
this.updateTabIndexes();
}

@Watch('length')
lengthChanged() {
this.initializeValues();
this.updateTabIndexesAfterRender = true;
}

/**
* Processes the separators prop into an array of numbers.
*
Expand Down Expand Up @@ -272,6 +284,13 @@ export class InputOTP implements ComponentInterface {
this.updateTabIndexes();
}

componentDidRender() {
if (this.updateTabIndexesAfterRender) {
this.updateTabIndexesAfterRender = false;
this.updateTabIndexes();
}
}

/**
* Get the regex pattern for allowed characters.
* If a pattern is provided, use it to create a regex pattern
Expand Down Expand Up @@ -851,7 +870,14 @@ export class InputOTP implements ComponentInterface {
tabIndex={index === tabbableIndex ? 0 : -1}
value={inputValues[index] || ''}
autocomplete="one-time-code"
ref={(el) => (inputRefs[index] = el as HTMLInputElement)}
ref={(el) => {
if (el) {
inputRefs[index] = el as HTMLInputElement;
} else {
// The input was removed, so drop its ref and any after it.
inputRefs.splice(index);
}
}}
onInput={this.onInput(index)}
onBlur={this.onBlur}
onFocus={this.onFocus(index)}
Expand Down
21 changes: 21 additions & 0 deletions core/src/components/input-otp/test/a11y/input-otp.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,27 @@ configs().forEach(({ title, config }) => {
await expect(inputBoxes.nth(3)).toHaveAttribute('aria-hidden', 'true');
});

test('should update aria-hidden when length increases', async ({ page }, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/31484',
});

await page.setContent(`<ion-input-otp length="2"></ion-input-otp>`, config);

const inputOtp = page.locator('ion-input-otp');
await inputOtp.evaluate((el: HTMLIonInputOtpElement) => {
el.length = 4;
});

const inputBoxes = page.locator('ion-input-otp input');

await expect(inputBoxes.nth(0)).toHaveAttribute('aria-hidden', 'false');
await expect(inputBoxes.nth(1)).toHaveAttribute('aria-hidden', 'true');
await expect(inputBoxes.nth(2)).toHaveAttribute('aria-hidden', 'true');
await expect(inputBoxes.nth(3)).toHaveAttribute('aria-hidden', 'true');
});

test('should update aria-hidden when typing a value', async ({ page }) => {
await page.setContent(`<ion-input-otp></ion-input-otp>`, config);

Expand Down
63 changes: 63 additions & 0 deletions core/src/components/input-otp/test/basic/input-otp.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,39 @@ configs({ modes: ['ios'] }).forEach(({ title, config }) => {
await verifyInputValues(inputOtp, ['1', '2', '3', '4', '5', '6', '7', '8']);
});

test('should synchronize the value when length changes', async ({ page }, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/31484',
});

await page.setContent(`<ion-input-otp length="4" value="1234">Description</ion-input-otp>`, config);

const inputOtp = page.locator('ion-input-otp');
await inputOtp.evaluate((el) => el.setAttribute('length', '2'));

await verifyInputValues(inputOtp, ['1', '2']);
});

test('should add empty input boxes when length increases', async ({ page }, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/31484',
});

await page.setContent(`<ion-input-otp length="2" value="12">Description</ion-input-otp>`, config);

const inputOtp = page.locator('ion-input-otp');
await inputOtp.evaluate((el: HTMLIonInputOtpElement) => {
el.length = 4;
});

const inputBoxes = page.locator('ion-input-otp input');
await expect(inputBoxes).toHaveCount(4);

await verifyInputValues(inputOtp, ['1', '2', '', '']);
});

test('should accept numbers only by default', async ({ page }) => {
await page.setContent(`<ion-input-otp>Description</ion-input-otp>`, config);

Expand Down Expand Up @@ -1033,6 +1066,36 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
await expect(ionChange).toHaveReceivedEventTimes(1);
});

test('should emit ionChange event when blurring with a new value after length decreases', async ({
page,
}, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/31484',
});

await page.setContent(`<ion-input-otp length="4">Description</ion-input-otp>`, config);

const ionChange = await page.spyOnEvent('ionChange');

const inputOtp = page.locator('ion-input-otp');
await inputOtp.evaluate((el: HTMLIonInputOtpElement) => {
el.length = 2;
});
await page.waitForChanges();

const firstInput = page.locator('ion-input-otp input').first();
await firstInput.focus();

await page.keyboard.type('12');

// Click outside the input to trigger the blur event
await page.mouse.click(0, 0);

await ionChange.next();
await expect(ionChange).toHaveReceivedEventDetail({ value: '12', event: { isTrusted: true } });
});

test('should not emit ionChange event when blurring with the same value', async ({ page }) => {
await page.setContent(`<ion-input-otp value="12">Description</ion-input-otp>`, config);

Expand Down
3 changes: 2 additions & 1 deletion core/src/components/menu/menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Build, Component, Element, Event, Host, Listen, Method, Prop, State, Wa
import { getTimeGivenProgression } from '@utils/animation/cubic-bezier';
import { focusFirstDescendant, focusLastDescendant } from '@utils/focus-trap';
import { GESTURE_CONTROLLER } from '@utils/gesture';
import { shouldUseCloseWatcher } from '@utils/hardware-back-button';
import { shouldUseCloseWatcher, updateCloseWatcher } from '@utils/hardware-back-button';
import type { Attributes } from '@utils/helpers';
import { inheritAriaAttributes, assert, clamp, isEndSide as isEnd } from '@utils/helpers';
import { printIonError } from '@utils/logging';
Expand Down Expand Up @@ -726,6 +726,7 @@ export class Menu implements ComponentInterface, MenuI {
// emit opened/closed events
this._isOpen = isOpen;
this.isAnimating = false;
updateCloseWatcher();
if (!this._isOpen) {
this.blocker.unblock();
}
Expand Down
71 changes: 71 additions & 0 deletions core/src/components/menu/test/close-watcher/menu.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { expect } from '@playwright/test';
import { configs, test } from '@utils/test/playwright';

/**
* This behavior does not vary across modes/directions
*/
configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) => {
test.describe(title('menu: close watcher'), () => {
test('should close the menu on a close request and release the back button', async ({ page, skip }, testInfo) => {
testInfo.annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/29648',
});
skip.browser((browserName: string) => browserName !== 'chromium', 'Only Chromium supports the CloseWatcher API');

await page.setContent(
`
<script>
window.Ionic.config.experimentalCloseWatcher = true;

// Count live watchers so the test can check the back button gets released
window.liveCloseWatchers = 0;
const NativeCloseWatcher = window.CloseWatcher;
window.CloseWatcher = class extends NativeCloseWatcher {
constructor(...args) {
super(...args);
window.liveCloseWatchers++;
this.addEventListener('close', () => this.release());
}
destroy() {
this.release();
super.destroy();
}
// A closed watcher can still be destroyed, so only count it once
release() {
if (!this.released) {
this.released = true;
window.liveCloseWatchers--;
}
}
};
</script>
<ion-app>
<ion-menu content-id="main">
<ion-content>Menu Content</ion-content>
</ion-menu>
<div class="ion-page" id="main">
<ion-content>Main Content</ion-content>
</div>
</ion-app>
`,
config
);

const menu = page.locator('ion-menu');
const ionDidOpen = await page.spyOnEvent('ionDidOpen');
const ionDidClose = await page.spyOnEvent('ionDidClose');

await menu.evaluate((el: HTMLIonMenuElement) => el.open());
await ionDidOpen.next();
expect(await page.evaluate(() => (window as any).liveCloseWatchers)).toBe(1);

// Escape sends a close request to the active CloseWatcher
await page.keyboard.press('Escape');

await ionDidClose.next();
await expect(menu).not.toHaveClass(/show-menu/);
expect(await page.evaluate(() => (window as any).liveCloseWatchers)).toBe(0);
});
});
});
3 changes: 3 additions & 0 deletions core/src/css/float-elements.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Global stylesheet: `:host-context()` never matches outside a shadow root
$rtl-use-host-context: false;

@import "../themes/ionic.globals";
@import "../themes/ionic.mixins";

Expand Down
38 changes: 38 additions & 0 deletions core/src/css/test/global-stylesheets.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { execFileSync } from 'child_process';
import { readdirSync } from 'fs';
import { dirname, join } from 'path';

const cssDir = join(__dirname, '..');
const sassCli = join(dirname(require.resolve('sass')), 'sass.js');

/**
* Compiles through the sass CLI, the same way `npm run css.sass` builds
* the published stylesheets. The sass JS API can't be imported here
* because it detects the spec window and never populates its exports.
*/
const compileStylesheet = (file: string) =>
execFileSync(process.execPath, [sassCli, '--style=compressed', '--no-source-map', join(cssDir, file)], {
encoding: 'utf8',
});

const globalStylesheets = ['.', 'palettes'].flatMap((dir) =>
readdirSync(join(cssDir, dir))
.filter((file) => file.endsWith('.scss'))
.map((file) => join(dir, file))
);

describe('global stylesheets', () => {
// https://github.com/ionic-team/ionic-framework/issues/30024
it.each(globalStylesheets)('%s should not contain :host-context', (file) => {
expect(compileStylesheet(file)).not.toContain(':host-context');
});

it('float-elements.scss should flip start and end floats for an ancestor dir=rtl', () => {
const css = compileStylesheet('float-elements.scss');

expect(css).toContain('[dir=rtl] .ion-float-start{float:right !important}');
expect(css).toContain('[dir=rtl] .ion-float-end{float:left !important}');
expect(css).toContain('.ion-float-start:dir(rtl){float:right !important}');
expect(css).toContain('.ion-float-end:dir(rtl){float:left !important}');
});
});
Loading
Loading