@ionic/core 8.0.0-dev.11713809015.1aabd368 → 8.0.0-dev.11713893672.15a2b23e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ion-datetime.js +3 -3
- package/components/picker-column.js +49 -26
- package/dist/cjs/ion-datetime_3.cjs.entry.js +3 -3
- package/dist/cjs/ion-picker-column.cjs.entry.js +49 -26
- package/dist/collection/components/datetime/datetime.js +3 -3
- package/dist/collection/components/picker-column/picker-column.js +49 -26
- package/dist/collection/components/picker-column/test/picker-column.spec.js +0 -20
- package/dist/docs.json +1 -1
- package/dist/esm/ion-datetime_3.entry.js +3 -3
- package/dist/esm/ion-picker-column.entry.js +49 -26
- package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
- package/dist/esm-es5/ion-picker-column.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-24a98ee7.entry.js +4 -0
- package/dist/ionic/p-3232c4de.entry.js +4 -0
- package/dist/ionic/p-587258c0.system.entry.js +4 -0
- package/dist/ionic/{p-e8c7fa1b.system.entry.js → p-92e46b28.system.entry.js} +1 -1
- package/dist/ionic/p-c478747f.system.js +1 -1
- package/dist/types/components/picker-column/picker-column.d.ts +7 -4
- package/hydrate/index.js +52 -29
- package/package.json +1 -1
- package/dist/ionic/p-0307a5ce.entry.js +0 -4
- package/dist/ionic/p-9958874b.system.entry.js +0 -4
- package/dist/ionic/p-bae993f0.entry.js +0 -4
|
@@ -80,24 +80,4 @@ describe('picker-column: assistive element', () => {
|
|
|
80
80
|
const assistiveFocusable = pickerCol.shadowRoot.querySelector('.assistive-focusable');
|
|
81
81
|
expect(assistiveFocusable.getAttribute('aria-valuetext')).toBe('My Text');
|
|
82
82
|
});
|
|
83
|
-
it('should have the correct value count attributes', async () => {
|
|
84
|
-
const page = await newSpecPage({
|
|
85
|
-
components: [PickerColumn, PickerColumnOption],
|
|
86
|
-
template: () => (h("ion-picker-column", { value: 2 }, h("ion-picker-column-option", { value: 1 }, "My Text"), h("ion-picker-column-option", { value: 2 }, "My Text"), h("ion-picker-column-option", { value: 3 }, "My Text"))),
|
|
87
|
-
});
|
|
88
|
-
const pickerCol = page.body.querySelector('ion-picker-column');
|
|
89
|
-
const assistiveFocusable = pickerCol.shadowRoot.querySelector('.assistive-focusable');
|
|
90
|
-
expect(assistiveFocusable.getAttribute('aria-valuemin')).toBe('0');
|
|
91
|
-
expect(assistiveFocusable.getAttribute('aria-valuemax')).toBe('2');
|
|
92
|
-
expect(assistiveFocusable.getAttribute('aria-valuenow')).toBe('1');
|
|
93
|
-
});
|
|
94
|
-
it('should clamp the value now attributes', async () => {
|
|
95
|
-
const page = await newSpecPage({
|
|
96
|
-
components: [PickerColumn, PickerColumnOption],
|
|
97
|
-
template: () => (h("ion-picker-column", null, h("ion-picker-column-option", { value: 1 }, "My Text"), h("ion-picker-column-option", { value: 2 }, "My Text"), h("ion-picker-column-option", { value: 3 }, "My Text"))),
|
|
98
|
-
});
|
|
99
|
-
const pickerCol = page.body.querySelector('ion-picker-column');
|
|
100
|
-
const assistiveFocusable = pickerCol.shadowRoot.querySelector('.assistive-focusable');
|
|
101
|
-
expect(assistiveFocusable.getAttribute('aria-valuenow')).toBe('0');
|
|
102
|
-
});
|
|
103
83
|
});
|
package/dist/docs.json
CHANGED
|
@@ -1448,7 +1448,7 @@ const Datetime = class {
|
|
|
1448
1448
|
}
|
|
1449
1449
|
const activePart = this.getActivePartsWithFallback();
|
|
1450
1450
|
const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
|
|
1451
|
-
return (h("ion-picker-column", { "aria-label": "Select a day", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
1451
|
+
return (h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
1452
1452
|
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1453
1453
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1454
1454
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { ampm: ev.detail.value, hour }));
|
|
@@ -1758,7 +1758,7 @@ const Datetime = class {
|
|
|
1758
1758
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1759
1759
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1760
1760
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1761
|
-
return (h(Host, { key: '
|
|
1761
|
+
return (h(Host, { key: '131cd9d8f73805ea76158c0ad05d86809fe8dfce', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1762
1762
|
[mode]: true,
|
|
1763
1763
|
['datetime-readonly']: readonly,
|
|
1764
1764
|
['datetime-disabled']: disabled,
|
|
@@ -1768,7 +1768,7 @@ const Datetime = class {
|
|
|
1768
1768
|
[`datetime-size-${size}`]: true,
|
|
1769
1769
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1770
1770
|
[`datetime-grid`]: isGridStyle,
|
|
1771
|
-
})) }, h("div", { key: '
|
|
1771
|
+
})) }, h("div", { key: '3be6976d484d9ccebac77630b2fd66388b2b85e4', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1772
1772
|
}
|
|
1773
1773
|
get el() { return getElement(this); }
|
|
1774
1774
|
static get watchers() { return {
|
|
@@ -19,6 +19,7 @@ const PickerColumn = class {
|
|
|
19
19
|
this.isScrolling = false;
|
|
20
20
|
this.isColumnVisible = false;
|
|
21
21
|
this.canExitInputMode = true;
|
|
22
|
+
this.updateValueTextOnScroll = false;
|
|
22
23
|
this.centerPickerItemInView = (target, smooth = true, canExitInputMode = true) => {
|
|
23
24
|
const { isColumnVisible, scrollEl } = this;
|
|
24
25
|
if (isColumnVisible && scrollEl) {
|
|
@@ -33,6 +34,7 @@ const PickerColumn = class {
|
|
|
33
34
|
* of these can cause a scroll to occur.
|
|
34
35
|
*/
|
|
35
36
|
this.canExitInputMode = canExitInputMode;
|
|
37
|
+
this.updateValueTextOnScroll = false;
|
|
36
38
|
scrollEl.scroll({
|
|
37
39
|
top,
|
|
38
40
|
left: 0,
|
|
@@ -102,9 +104,10 @@ const PickerColumn = class {
|
|
|
102
104
|
const enableHaptics = isPlatform('ios');
|
|
103
105
|
const { el, scrollEl } = this;
|
|
104
106
|
let timeout;
|
|
105
|
-
let
|
|
107
|
+
let activeEl = this.activeItem;
|
|
106
108
|
const scrollCallback = () => {
|
|
107
109
|
raf(() => {
|
|
110
|
+
var _a;
|
|
108
111
|
if (!scrollEl)
|
|
109
112
|
return;
|
|
110
113
|
if (timeout) {
|
|
@@ -185,8 +188,23 @@ const PickerColumn = class {
|
|
|
185
188
|
}
|
|
186
189
|
activeEl = newActiveElement;
|
|
187
190
|
this.setPickerItemActiveState(newActiveElement, true);
|
|
191
|
+
/**
|
|
192
|
+
* Set the aria-valuetext even though the value prop has not been updated yet.
|
|
193
|
+
* This enables some screen readers to announce the value as the users drag
|
|
194
|
+
* as opposed to when their release their pointer from the screen.
|
|
195
|
+
*
|
|
196
|
+
* When the value is programmatically updated, we will smoothly scroll
|
|
197
|
+
* to the new option. However, we do not want to update aria-valuetext mid-scroll
|
|
198
|
+
* as that can cause the old value to be briefly set before being set to the
|
|
199
|
+
* correct option. This will cause some screen readers to announce the old value
|
|
200
|
+
* again before announcing the new value. The correct valuetext will be set on render.
|
|
201
|
+
*/
|
|
202
|
+
if (this.updateValueTextOnScroll) {
|
|
203
|
+
(_a = this.assistiveFocusable) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-valuetext', this.getOptionValueText(newActiveElement));
|
|
204
|
+
}
|
|
188
205
|
timeout = setTimeout(() => {
|
|
189
206
|
this.isScrolling = false;
|
|
207
|
+
this.updateValueTextOnScroll = true;
|
|
190
208
|
enableHaptics && hapticSelectionEnd();
|
|
191
209
|
/**
|
|
192
210
|
* Certain tasks (such as those that
|
|
@@ -254,7 +272,7 @@ const PickerColumn = class {
|
|
|
254
272
|
* may be past the stride if the option at the stride is disabled.
|
|
255
273
|
*/
|
|
256
274
|
this.findNextOption = (stride = 1) => {
|
|
257
|
-
const { activeItem } = this
|
|
275
|
+
const { activeItem } = this;
|
|
258
276
|
if (!activeItem)
|
|
259
277
|
return null;
|
|
260
278
|
let prevNode = activeItem;
|
|
@@ -281,7 +299,7 @@ const PickerColumn = class {
|
|
|
281
299
|
* may be past the stride if the option at the stride is disabled.
|
|
282
300
|
*/
|
|
283
301
|
this.findPreviousOption = (stride = 1) => {
|
|
284
|
-
const { activeItem } = this
|
|
302
|
+
const { activeItem } = this;
|
|
285
303
|
if (!activeItem)
|
|
286
304
|
return null;
|
|
287
305
|
let nextNode = activeItem;
|
|
@@ -335,6 +353,13 @@ const PickerColumn = class {
|
|
|
335
353
|
ev.preventDefault();
|
|
336
354
|
}
|
|
337
355
|
};
|
|
356
|
+
/**
|
|
357
|
+
* Utility to generate the correct text for aria-valuetext.
|
|
358
|
+
*/
|
|
359
|
+
this.getOptionValueText = (el) => {
|
|
360
|
+
var _a;
|
|
361
|
+
return el ? (_a = el.getAttribute('aria-label')) !== null && _a !== void 0 ? _a : el.innerText : '';
|
|
362
|
+
};
|
|
338
363
|
/**
|
|
339
364
|
* Render an element that overlays the column. This element is for assistive
|
|
340
365
|
* tech to allow users to navigate the column up/down. This element should receive
|
|
@@ -342,11 +367,15 @@ const PickerColumn = class {
|
|
|
342
367
|
* slider role: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/slider_role
|
|
343
368
|
*/
|
|
344
369
|
this.renderAssistiveFocusable = () => {
|
|
345
|
-
|
|
346
|
-
const
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
370
|
+
const { activeItem } = this;
|
|
371
|
+
const valueText = this.getOptionValueText(activeItem);
|
|
372
|
+
/**
|
|
373
|
+
* When using the picker, the valuetext provides important context that valuenow
|
|
374
|
+
* does not. Additionally, using non-zero valuemin/valuemax values can cause
|
|
375
|
+
* WebKit to incorrectly announce numeric valuetext values (such as a year
|
|
376
|
+
* like "2024") as percentages: https://bugs.webkit.org/show_bug.cgi?id=273126
|
|
377
|
+
*/
|
|
378
|
+
return (h("div", { ref: (el) => (this.assistiveFocusable = el), class: "assistive-focusable", role: "slider", tabindex: this.disabled ? undefined : 0, "aria-label": this.ariaLabel, "aria-valuemin": 0, "aria-valuemax": 0, "aria-valuenow": 0, "aria-valuetext": valueText, "aria-orientation": "vertical", onKeyDown: (ev) => this.onKeyDown(ev) }));
|
|
350
379
|
};
|
|
351
380
|
this.ariaLabel = null;
|
|
352
381
|
this.isActive = false;
|
|
@@ -388,8 +417,7 @@ const PickerColumn = class {
|
|
|
388
417
|
*/
|
|
389
418
|
const ev = entries[entries.length - 1];
|
|
390
419
|
if (ev.isIntersecting) {
|
|
391
|
-
const { activeItem } = this
|
|
392
|
-
const { el } = this;
|
|
420
|
+
const { activeItem, el } = this;
|
|
393
421
|
this.isColumnVisible = true;
|
|
394
422
|
/**
|
|
395
423
|
* Because this initial call to scrollActiveItemIntoView has to fire before
|
|
@@ -429,8 +457,7 @@ const PickerColumn = class {
|
|
|
429
457
|
}
|
|
430
458
|
}
|
|
431
459
|
componentDidRender() {
|
|
432
|
-
const { activeItem } = this
|
|
433
|
-
const { el, isColumnVisible, value } = this;
|
|
460
|
+
const { el, activeItem, isColumnVisible, value } = this;
|
|
434
461
|
if (isColumnVisible && !activeItem) {
|
|
435
462
|
const firstOption = el.querySelector('ion-picker-column-option');
|
|
436
463
|
/**
|
|
@@ -447,7 +474,7 @@ const PickerColumn = class {
|
|
|
447
474
|
}
|
|
448
475
|
/** @internal */
|
|
449
476
|
async scrollActiveItemIntoView(smooth = false) {
|
|
450
|
-
const
|
|
477
|
+
const activeEl = this.activeItem;
|
|
451
478
|
if (activeEl) {
|
|
452
479
|
this.centerPickerItemInView(activeEl, smooth, false);
|
|
453
480
|
}
|
|
@@ -481,33 +508,29 @@ const PickerColumn = class {
|
|
|
481
508
|
}
|
|
482
509
|
get activeItem() {
|
|
483
510
|
const { value } = this;
|
|
484
|
-
const options = this.el.querySelectorAll('ion-picker-column-option');
|
|
485
|
-
|
|
486
|
-
const option = options[i];
|
|
511
|
+
const options = Array.from(this.el.querySelectorAll('ion-picker-column-option'));
|
|
512
|
+
return options.find((option) => {
|
|
487
513
|
/**
|
|
488
514
|
* If the whole picker column is disabled, the current value should appear active
|
|
489
515
|
* If the current value item is specifically disabled, it should not appear active
|
|
490
516
|
*/
|
|
491
|
-
if (
|
|
492
|
-
return
|
|
493
|
-
activeItem: option,
|
|
494
|
-
activeItemIndex: i,
|
|
495
|
-
};
|
|
517
|
+
if (!this.disabled && option.disabled) {
|
|
518
|
+
return false;
|
|
496
519
|
}
|
|
497
|
-
|
|
498
|
-
|
|
520
|
+
return option.value === value;
|
|
521
|
+
});
|
|
499
522
|
}
|
|
500
523
|
render() {
|
|
501
524
|
const { color, disabled, isActive, numericInput } = this;
|
|
502
525
|
const mode = getIonMode(this);
|
|
503
|
-
return (h(Host, { key: '
|
|
526
|
+
return (h(Host, { key: '50fe50a49f88aa9ec435436083f3cd1ef49c8c9c', class: createColorClasses(color, {
|
|
504
527
|
[mode]: true,
|
|
505
528
|
['picker-column-active']: isActive,
|
|
506
529
|
['picker-column-numeric-input']: numericInput,
|
|
507
530
|
['picker-column-disabled']: disabled,
|
|
508
|
-
}) }, this.renderAssistiveFocusable(), h("slot", { key: '
|
|
531
|
+
}) }, this.renderAssistiveFocusable(), h("slot", { key: '6350829748690895ab3ef101b9f2ae993852de7d', name: "prefix" }), h("div", { key: 'eaff9925aa8553f63ba2a1ae2bdfaa02963e0a5d', "aria-hidden": "true", class: "picker-opts", ref: (el) => {
|
|
509
532
|
this.scrollEl = el;
|
|
510
|
-
} }, h("div", { key: '
|
|
533
|
+
} }, h("div", { key: '25a24c4174782f2ec8a1fe06cbaf1f564b1f632f', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '7f4e9a5f1f74f7e8d5ad74178894edc80c0fb523', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '329b88b4af1d0e37da347e5f3fe9b462efcc2886', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("slot", { key: '82b9d5d541d41801bce06db0867d6cfbcee4ac3e' }), h("div", { key: '288ae193601d1eb49ead06f79eb1affa478f31d3', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: '29661d0b74d11d650c2b23be66f857dd008dc5a0', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0"), h("div", { key: 'a7bd71b4abcb027654a828ffa65d87b6874d7484', class: "picker-item-empty", "aria-hidden": "true" }, "\u00A0")), h("slot", { key: '83ddd19d09ec48fe31b51f9f272a562320f90098', name: "suffix" })));
|
|
511
534
|
}
|
|
512
535
|
get el() { return getElement(this); }
|
|
513
536
|
static get watchers() { return {
|