@descope/web-components-ui 3.27.4 → 3.27.5

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.
Files changed (37) hide show
  1. package/dist/cjs/index.cjs.js +81 -9
  2. package/dist/cjs/index.cjs.js.map +1 -1
  3. package/dist/index.esm.js +81 -9
  4. package/dist/index.esm.js.map +1 -1
  5. package/dist/umd/9439.js +1 -1
  6. package/dist/umd/9439.js.map +1 -1
  7. package/dist/umd/DescopeDev.js +1 -1
  8. package/dist/umd/DescopeDev.js.map +1 -1
  9. package/dist/umd/descope-collapsible-container.js +1 -1
  10. package/dist/umd/descope-collapsible-container.js.map +1 -1
  11. package/dist/umd/descope-hybrid-field-index-js.js +3 -3
  12. package/dist/umd/descope-hybrid-field-index-js.js.map +1 -1
  13. package/dist/umd/descope-new-password-index-js.js +1 -1
  14. package/dist/umd/descope-new-password-index-js.js.map +1 -1
  15. package/dist/umd/descope-passcode-index-js.js +1 -1
  16. package/dist/umd/descope-passcode-index-js.js.map +1 -1
  17. package/dist/umd/descope-security-questions-setup-index-js.js +1 -1
  18. package/dist/umd/descope-security-questions-setup-index-js.js.map +1 -1
  19. package/dist/umd/descope-security-questions-verify-index-js.js +1 -1
  20. package/dist/umd/descope-security-questions-verify-index-js.js.map +1 -1
  21. package/dist/umd/descope-text-field.js +1 -1
  22. package/dist/umd/descope-text-field.js.map +1 -1
  23. package/dist/umd/index.js +1 -1
  24. package/dist/umd/index.js.map +1 -1
  25. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js +1 -1
  26. package/dist/umd/mapping-fields-descope-mappings-field-index-js.js.map +1 -1
  27. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js +1 -1
  28. package/dist/umd/mapping-fields-descope-saml-group-mappings-index-js.js.map +1 -1
  29. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js +1 -1
  30. package/dist/umd/phone-fields-descope-phone-field-descope-phone-field-internal-index-js.js.map +1 -1
  31. package/dist/umd/phone-fields-descope-phone-field-index-js.js +1 -1
  32. package/dist/umd/phone-fields-descope-phone-field-index-js.js.map +1 -1
  33. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js +1 -1
  34. package/dist/umd/phone-fields-descope-phone-input-box-field-descope-phone-input-box-internal-index-js.js.map +1 -1
  35. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js +1 -1
  36. package/dist/umd/phone-fields-descope-phone-input-box-field-index-js.js.map +1 -1
  37. package/package.json +46 -46
@@ -9550,7 +9550,7 @@ class RawCollapsibleContainer extends createBaseClass$1({
9550
9550
  baseSelector: 'slot',
9551
9551
  }) {
9552
9552
  static get observedAttributes() {
9553
- return ['collapsed', 'collapsible', 'text'];
9553
+ return ['collapsed', 'collapsible', 'text', 'aria-label'];
9554
9554
  }
9555
9555
 
9556
9556
  constructor() {
@@ -9661,7 +9661,31 @@ class RawCollapsibleContainer extends createBaseClass$1({
9661
9661
  this.setAttribute('collapsed', this.isCollapsed ? 'false' : 'true');
9662
9662
  }
9663
9663
 
9664
+ // header acts as a disclosure button only when the container is collapsible
9665
+ updateHeaderA11y() {
9666
+ if (!this.isCollapsible) {
9667
+ ['role', 'tabindex', 'aria-expanded', 'aria-label'].forEach((attr) =>
9668
+ this.header.removeAttribute(attr),
9669
+ );
9670
+ return;
9671
+ }
9672
+ this.header.setAttribute('role', 'button');
9673
+ this.header.setAttribute('tabindex', '0');
9674
+ this.header.setAttribute('aria-expanded', String(!this.isCollapsed));
9675
+ // without header text the button has no name, so fall back to a label
9676
+ if (this.getAttribute('text')) {
9677
+ this.header.removeAttribute('aria-label');
9678
+ } else {
9679
+ this.header.setAttribute(
9680
+ 'aria-label',
9681
+ this.getAttribute('aria-label') || 'Toggle section',
9682
+ );
9683
+ }
9684
+ }
9685
+
9664
9686
  collapse(animated = false) {
9687
+ // keep collapsed content out of the tab order and the a11y tree
9688
+ this.content.inert = true;
9665
9689
  const final = () => {
9666
9690
  this.content.style.maxHeight = '0px';
9667
9691
  };
@@ -9673,6 +9697,7 @@ class RawCollapsibleContainer extends createBaseClass$1({
9673
9697
  }
9674
9698
 
9675
9699
  expand(animated = false) {
9700
+ this.content.inert = false;
9676
9701
  const final = () => {
9677
9702
  this.content.style.maxHeight = '';
9678
9703
  };
@@ -9695,6 +9720,13 @@ class RawCollapsibleContainer extends createBaseClass$1({
9695
9720
  if (!this.isCollapsible) return;
9696
9721
  this.toggle();
9697
9722
  });
9723
+ this.header.addEventListener('keydown', (e) => {
9724
+ if (!this.isCollapsible || (e.key !== 'Enter' && e.key !== ' ')) return;
9725
+ e.preventDefault();
9726
+ // the SDK submits the flow on any Enter that reaches the flow root
9727
+ e.stopPropagation();
9728
+ this.toggle();
9729
+ });
9698
9730
  forwardAttrs(this, this.textComponent, {
9699
9731
  includeAttrs: ['text-align', 'text-variant', 'text-mode'],
9700
9732
  mapAttrs: { 'text-mode': 'mode', 'text-variant': 'variant' },
@@ -9709,8 +9741,14 @@ class RawCollapsibleContainer extends createBaseClass$1({
9709
9741
  attributeChangedCallback(name, oldValue, newValue) {
9710
9742
  if (name === 'text') {
9711
9743
  this.updateHeaderText();
9744
+ this.updateHeaderA11y();
9712
9745
  return;
9713
9746
  }
9747
+ if (name === 'aria-label') {
9748
+ this.updateHeaderA11y();
9749
+ return;
9750
+ }
9751
+ this.updateHeaderA11y();
9714
9752
  const collapsed = this.isCollapsed && this.isCollapsible;
9715
9753
  if (collapsed) {
9716
9754
  this.collapse(this.#isComponentMounted);
@@ -14878,6 +14916,7 @@ const customMixin$b = (superclass) =>
14878
14916
  renderCopyToClipboard(shouldRender) {
14879
14917
  if (!shouldRender) {
14880
14918
  this.icon?.remove();
14919
+ this.copyLiveRegion?.remove();
14881
14920
  return;
14882
14921
  }
14883
14922
 
@@ -14893,20 +14932,53 @@ const customMixin$b = (superclass) =>
14893
14932
  style: 'cursor: initial',
14894
14933
  };
14895
14934
 
14935
+ const setIconState = (config) => {
14936
+ Object.assign(this.icon, config);
14937
+ this.icon.setAttribute('aria-label', config.title);
14938
+ };
14939
+
14896
14940
  this.icon = Object.assign(document.createElement('vaadin-icon'), {
14897
14941
  slot: 'suffix',
14898
- ...iconInitConfig,
14942
+ tabIndex: 0,
14899
14943
  });
14944
+ this.icon.setAttribute('role', 'button');
14945
+ setIconState(iconInitConfig);
14946
+
14947
+ // visually hidden live region, so screen readers announce the copy
14948
+ this.copyLiveRegion = document.createElement('span');
14949
+ this.copyLiveRegion.setAttribute('aria-live', 'polite');
14950
+ this.copyLiveRegion.style.cssText =
14951
+ 'position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;';
14900
14952
 
14901
14953
  this.baseElement.appendChild(this.icon);
14902
- this.icon.addEventListener('click', () => {
14903
- navigator.clipboard.writeText(this.value);
14904
- Object.assign(this.icon, iconCopiedConfig);
14954
+ this.shadowRoot.appendChild(this.copyLiveRegion);
14905
14955
 
14906
- // we want the icon to go back to the initial state after 5 seconds
14907
- setTimeout(() => {
14908
- Object.assign(this.icon, iconInitConfig);
14909
- }, 5000);
14956
+ let resetTimer;
14957
+ const copy = async () => {
14958
+ try {
14959
+ await navigator.clipboard.writeText(this.value);
14960
+ } catch {
14961
+ return;
14962
+ }
14963
+ setIconState(iconCopiedConfig);
14964
+ this.copyLiveRegion.textContent = 'Copied';
14965
+
14966
+ // we want the icon to go back to the initial state after 3 seconds
14967
+ // a repeated copy restarts the countdown
14968
+ clearTimeout(resetTimer);
14969
+ resetTimer = setTimeout(() => {
14970
+ setIconState(iconInitConfig);
14971
+ this.copyLiveRegion.textContent = '';
14972
+ }, 3000);
14973
+ };
14974
+
14975
+ this.icon.addEventListener('click', copy);
14976
+ this.icon.addEventListener('keydown', (e) => {
14977
+ if (e.key !== 'Enter' && e.key !== ' ') return;
14978
+ e.preventDefault();
14979
+ // the SDK submits the flow on any Enter that reaches the flow root
14980
+ e.stopPropagation();
14981
+ copy();
14910
14982
  });
14911
14983
  }
14912
14984