@vaadin/component-base
Advanced tools
Comparing version 23.0.0-beta1 to 23.0.0-beta2
@@ -9,4 +9,5 @@ export { ActiveMixin } from './src/active-mixin.js'; | ||
export { KeyboardMixin } from './src/keyboard-mixin.js'; | ||
export { ResizeMixin } from './src/resize-mixin.js'; | ||
export { SlotController } from './src/slot-controller.js'; | ||
export { SlotMixin } from './src/slot-mixin.js'; | ||
export { TabindexMixin } from './src/tabindex-mixin.js'; |
{ | ||
"name": "@vaadin/component-base", | ||
"version": "23.0.0-beta1", | ||
"version": "23.0.0-beta2", | ||
"publishConfig": { | ||
@@ -45,3 +45,3 @@ "access": "public" | ||
}, | ||
"gitHead": "467244b76021176c109df675799b07029b293e58" | ||
"gitHead": "a276f7a0fd00e5459b87267468e0dd0d4fb6f7f3" | ||
} |
@@ -10,2 +10,2 @@ /** | ||
*/ | ||
export function announce(text: string, options?: { mode?: 'polite' | 'assertive'; timeout?: number }): void; | ||
export function announce(text: string, options?: { mode?: 'polite' | 'assertive' | 'alert'; timeout?: number }): void; |
@@ -7,2 +7,5 @@ /** | ||
import { animationFrame } from '@vaadin/component-base/src/async.js'; | ||
import { Debouncer } from '@vaadin/component-base/src/debounce.js'; | ||
const region = document.createElement('div'); | ||
@@ -16,2 +19,3 @@ | ||
let alertDebouncer; | ||
/** | ||
@@ -27,3 +31,15 @@ * Cause a text string to be announced by screen readers. | ||
region.setAttribute('aria-live', mode); | ||
if (mode === 'alert') { | ||
region.removeAttribute('aria-live'); | ||
region.removeAttribute('role'); | ||
alertDebouncer = Debouncer.debounce(alertDebouncer, animationFrame, () => { | ||
region.setAttribute('role', 'alert'); | ||
}); | ||
} else { | ||
if (alertDebouncer) { | ||
alertDebouncer.cancel(); | ||
} | ||
region.removeAttribute('role'); | ||
region.setAttribute('aria-live', mode); | ||
} | ||
@@ -30,0 +46,0 @@ region.textContent = ''; |
@@ -35,3 +35,3 @@ /** | ||
static get version() { | ||
return '23.0.0-beta1'; | ||
return '23.0.0-beta2'; | ||
} | ||
@@ -38,0 +38,0 @@ |
@@ -137,4 +137,5 @@ /** | ||
get __focusedElementIndex() { | ||
return this.__focusableElements.findIndex(isElementFocused); | ||
const focusableElements = this.__focusableElements; | ||
return focusableElements.indexOf(focusableElements.filter(isElementFocused).pop()); | ||
} | ||
} |
@@ -42,3 +42,3 @@ /** | ||
function normalizeTabIndex(element) { | ||
if (!isElementFocusable(element) || isElementHiddenDirectly(element)) { | ||
if (!isElementFocusable(element)) { | ||
return -1; | ||
@@ -120,4 +120,4 @@ } | ||
function collectFocusableNodes(node, result) { | ||
if (node.nodeType !== Node.ELEMENT_NODE) { | ||
// Don't traverse children if the node is not an HTML element. | ||
if (node.nodeType !== Node.ELEMENT_NODE || isElementHiddenDirectly(node)) { | ||
// Don't traverse children if the node is not an HTML element or not visible. | ||
return false; | ||
@@ -124,0 +124,0 @@ } |
@@ -6,2 +6,3 @@ /** | ||
*/ | ||
import { dashToCamelCase } from '@polymer/polymer/lib/utils/case-map.js'; | ||
import { FlattenedNodesObserver } from '@polymer/polymer/lib/utils/flattened-nodes-observer.js'; | ||
@@ -34,6 +35,9 @@ | ||
// Support dash-case slot names e.g. "error-message" | ||
const field = `${dashToCamelCase(prefix)}Id`; | ||
// Maintain the unique ID counter for a given prefix. | ||
this[`${prefix}Id`] = 1 + this[`${prefix}Id`] || 0; | ||
this[field] = 1 + this[field] || 0; | ||
return `${prefix}-${host.localName}-${this[`${prefix}Id`]}`; | ||
return `${prefix}-${host.localName}-${this[field]}`; | ||
} | ||
@@ -40,0 +44,0 @@ |
@@ -59,3 +59,5 @@ /** | ||
if (disabled) { | ||
this.__lastTabIndex = this.tabindex; | ||
if (this.tabindex !== undefined) { | ||
this.__lastTabIndex = this.tabindex; | ||
} | ||
this.tabindex = -1; | ||
@@ -62,0 +64,0 @@ } else if (oldDisabled) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159786
4488