chore(): sync

This commit is contained in:
Liam DeBeasi
2024-01-25 12:35:32 -05:00
110 changed files with 1819 additions and 585 deletions

View File

@ -267,6 +267,7 @@ export class Picker implements ComponentInterface {
inputEl.focus();
} else {
// TODO FW-5900 Use keydown instead
el.addEventListener('keypress', this.onKeyPress);
this.destroyKeypressListener = () => {
el.removeEventListener('keypress', this.onKeyPress);
@ -559,6 +560,21 @@ export class Picker implements ComponentInterface {
tabindex={-1}
inputmode="numeric"
type="number"
onKeyDown={(ev: KeyboardEvent) => {
/**
* The "Enter" key represents
* the user submitting their time
* selection, so we should blur the
* input (and therefore close the keyboard)
*
* Updating the picker's state to no longer
* be in input mode is handled in the onBlur
* callback below.
*/
if (ev.key === 'Enter') {
this.inputEl?.blur();
}
}}
ref={(el) => (this.inputEl = el)}
onInput={() => this.onInputChange()}
onBlur={() => this.exitInputMode()}

View File

@ -163,5 +163,44 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
await expect(ionChange).toHaveReceivedEventDetail({ value: 12 });
await expect(column).toHaveJSProperty('value', 12);
});
test('pressing Enter should dismiss the keyboard', async ({ page }) => {
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/ionic-team/ionic-framework/issues/28325',
});
await page.setContent(
`
<ion-picker-internal>
<ion-picker-column-internal></ion-picker-column-internal>
</ion-picker-internal>
<script>
const column = document.querySelector('ion-picker-column-internal');
column.items = [
{ text: '00', value: 12 },
{ text: '01', value: 1 },
{ text: '02', value: 2 },
{ text: '03', value: 3 },
{ text: '04', value: 4 },
{ text: '05', value: 5 }
];
column.value = 5;
column.numericInput = true;
</script>
`,
config
);
const column = page.locator('ion-picker-column-internal');
await column.click();
const input = page.locator('ion-picker-internal input');
await expect(input).toBeFocused();
// pressing Enter should blur the input and therefore close the keyboard
await page.keyboard.press('Enter');
await expect(input).not.toBeFocused();
});
});
});