@aurodesignsystem-dev/auro-dialog 0.0.0-pr84.0 → 0.0.0-pr87.1

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/demo/api.js CHANGED
@@ -5,6 +5,7 @@ import { initEditCloseButtonExample } from "../apiExamples/editCloseButton";
5
5
  import { initModalExample } from "../apiExamples/modal";
6
6
  import { initPopoverAndDropdownExample } from "../apiExamples/popoverAndDropdown";
7
7
  import { initSizeOptionsExample } from "../apiExamples/sizeOptions";
8
+ import { initAriaLabelSlotExample } from "../apiExamples/ariaLabelSlot";
8
9
 
9
10
  import "../src/registered"
10
11
 
@@ -20,6 +21,7 @@ export function initExamples(initCount) {
20
21
  initModalExample();
21
22
  initPopoverAndDropdownExample();
22
23
  initSizeOptionsExample();
24
+ initAriaLabelSlotExample();
23
25
  } catch (_err) {
24
26
  if (initCount <= 20) {
25
27
  // setTimeout handles issue where content is sometimes loaded after the functions get called
package/demo/api.md CHANGED
@@ -30,11 +30,12 @@ The auro-dialog appears above the page and requires the user's attention.
30
30
 
31
31
  ## Slots
32
32
 
33
- | Name | Description |
34
- |-----------|--------------------------------------------|
35
- | [content](#content) | Injects content into the body of the modal |
36
- | [footer](#footer) | Used for action options, e.g. buttons |
37
- | [header](#header) | Text to display as the header of the modal |
33
+ | Name | Description |
34
+ |-------------------------|--------------------------------------------------|
35
+ | `ariaLabel.closeButton` | Text to describe the close button for screen readers. Default: "Close". |
36
+ | [content](#content) | Injects content into the body of the modal |
37
+ | [footer](#footer) | Used for action options, e.g. buttons |
38
+ | [header](#header) | Text to display as the header of the modal |
38
39
 
39
40
  ## CSS Shadow Parts
40
41
 
@@ -721,6 +722,51 @@ When using the dialog with the `unformatted` attribute, some may want to adjust
721
722
  <!-- AURO-GENERATED-CONTENT:END -->
722
723
  </auro-accordion>
723
724
 
725
+ ### Close button aria-label slot
726
+
727
+ To customize the aria-label text for the close button, use the `ariaLabel.closeButton` slot to provide custom text. If no text is provided, the default text `"Close"` will be used.
728
+
729
+ <div class="exampleWrapper">
730
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/ariaLabelSlot.html) -->
731
+ <!-- The below content is automatically added from ./../apiExamples/ariaLabelSlot.html -->
732
+ <div>
733
+ <auro-button id="openAriaLabelSlot">Unformatted Dialog w/ custom close button aria-label</auro-button>
734
+ </div>
735
+ <auro-dialog id="ariaLabelMdDialog" unformatted md lg ondark>
736
+ <span slot="ariaLabel.closeButton">This will be the new aria label for the close button</span>
737
+ <span slot="content">
738
+ <img style="display: block; width: 100%" src="https://blog.alaskaair.com/wp-content/uploads/2020/11/111-psp-blog-img-guide.jpg" alt="alaska airlines pride lights" />
739
+ <div class="unformattedWrapper">
740
+ <h1 id="dialog-header" class="heading-lg">This is a header</h1>
741
+ These are words that are slotted into the scope of the custom element.
742
+ </div>
743
+ </span>
744
+ </auro-dialog>
745
+ <!-- AURO-GENERATED-CONTENT:END -->
746
+ </div>
747
+ <auro-accordion alignRight>
748
+ <span slot="trigger">See code</span>
749
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/ariaLabelSlot.html) -->
750
+ <!-- The below code snippet is automatically added from ./../apiExamples/ariaLabelSlot.html -->
751
+
752
+ ```html
753
+ <div>
754
+ <auro-button id="openAriaLabelSlot">Unformatted Dialog w/ custom close button aria-label</auro-button>
755
+ </div>
756
+ <auro-dialog id="ariaLabelMdDialog" unformatted md lg ondark>
757
+ <span slot="ariaLabel.closeButton">This will be the new aria label for the close button</span>
758
+ <span slot="content">
759
+ <img style="display: block; width: 100%" src="https://blog.alaskaair.com/wp-content/uploads/2020/11/111-psp-blog-img-guide.jpg" alt="alaska airlines pride lights" />
760
+ <div class="unformattedWrapper">
761
+ <h1 id="dialog-header" class="heading-lg">This is a header</h1>
762
+ These are words that are slotted into the scope of the custom element.
763
+ </div>
764
+ </span>
765
+ </auro-dialog>
766
+ ```
767
+ <!-- AURO-GENERATED-CONTENT:END -->
768
+ </auro-accordion>
769
+
724
770
  ### Theme Support
725
771
 
726
772
  The component may be restyled using the following code sample and changing the values of the following token(s).
package/demo/api.min.js CHANGED
@@ -178,6 +178,19 @@ function initSizeOptionsExample() {
178
178
  });
179
179
  }
180
180
 
181
+ function initAriaLabelSlotExample() {
182
+ const button = document.querySelector("#openAriaLabelSlot");
183
+ const dialog = document.querySelector("#ariaLabelMdDialog");
184
+
185
+ button.addEventListener("click", () => {
186
+ if (dialog.hasAttribute("open")) {
187
+ dialog.removeAttribute("open");
188
+ } else {
189
+ dialog.setAttribute("open", true);
190
+ }
191
+ });
192
+ }
193
+
181
194
  AuroDialog.register();
182
195
 
183
196
  function initExamples(initCount) {
@@ -192,6 +205,7 @@ function initExamples(initCount) {
192
205
  initModalExample();
193
206
  initPopoverAndDropdownExample();
194
207
  initSizeOptionsExample();
208
+ initAriaLabelSlotExample();
195
209
  } catch (_err) {
196
210
  if (initCount <= 20) {
197
211
  // setTimeout handles issue where content is sometimes loaded after the functions get called