@@ -378,6 +378,7 @@ The `rounded` attribute supports the ability to hide/show the text of the `auro-
export function toggledTextExample() {
const toggledTextElem = document.querySelector('#toggledTextElem');
+ // The mouseover and mouseout events are to simulate toggling text for mouse users
toggledTextElem.addEventListener('mouseover', () => {
toggledTextElem.iconOnly = false;
});
@@ -385,6 +386,15 @@ export function toggledTextExample() {
toggledTextElem.addEventListener('mouseout', () => {
toggledTextElem.iconOnly = true;
});
+
+ // The focusin and focusout events are to simulate toggling text for keyboard users
+ toggledTextElem.addEventListener('focusin', () => {
+ toggledTextElem.iconOnly = false;
+ });
+
+ toggledTextElem.addEventListener('focusout', () => {
+ toggledTextElem.iconOnly = true;
+ });
}
```
@@ -392,13 +402,13 @@ export function toggledTextExample() {
#### Right Aligned
-This example shows a `rounded` `auro-button` that is right-aligned, demonstrating how the button starts from the right and grows/shrinks from right to left when using the `toggleText` attribute in conjuction with the `mouseover` and `mouseout` events.
+This example shows a `rounded` `auro-button` that is right-aligned, demonstrating how the button starts from the right and grows/shrinks from right to left when using the `toggleText` attribute in conjuction with the `mouseover` and `mouseout` events. The `focusin` and `focusout` events simulate toggling text for keyboard users.
- Back to Top
+ Text is now shown!
@@ -410,7 +420,7 @@ This example shows a `rounded` `auro-button` that is right-aligned, demonstratin
```html
- Back to Top
+ Text is now shown!
```
@@ -422,6 +432,7 @@ This example shows a `rounded` `auro-button` that is right-aligned, demonstratin
export function roundedRightAlignExample() {
const rightAlignElem = document.querySelector('#rightAlignElem');
+ // The mouseover and mouseout events are to simulate toggling text for mouse users
rightAlignElem.addEventListener('mouseover', () => {
rightAlignElem.iconOnly = false;
});
@@ -429,6 +440,15 @@ export function roundedRightAlignExample() {
rightAlignElem.addEventListener('mouseout', () => {
rightAlignElem.iconOnly = true;
});
+
+ // The focusin and focusout events are to simulate toggling text for keyboard users
+ rightAlignElem.addEventListener('focusin', () => {
+ rightAlignElem.iconOnly = false;
+ });
+
+ rightAlignElem.addEventListener('focusout', () => {
+ rightAlignElem.iconOnly = true;
+ });
}
```
diff --git a/demo/api.min.js b/demo/api.min.js
index 7a55004..5162973 100644
--- a/demo/api.min.js
+++ b/demo/api.min.js
@@ -1,6 +1,7 @@
function toggledTextExample() {
const toggledTextElem = document.querySelector('#toggledTextElem');
+ // The mouseover and mouseout events are to simulate toggling text for mouse users
toggledTextElem.addEventListener('mouseover', () => {
toggledTextElem.iconOnly = false;
});
@@ -8,11 +9,21 @@ function toggledTextExample() {
toggledTextElem.addEventListener('mouseout', () => {
toggledTextElem.iconOnly = true;
});
+
+ // The focusin and focusout events are to simulate toggling text for keyboard users
+ toggledTextElem.addEventListener('focusin', () => {
+ toggledTextElem.iconOnly = false;
+ });
+
+ toggledTextElem.addEventListener('focusout', () => {
+ toggledTextElem.iconOnly = true;
+ });
}
function roundedRightAlignExample() {
const rightAlignElem = document.querySelector('#rightAlignElem');
+ // The mouseover and mouseout events are to simulate toggling text for mouse users
rightAlignElem.addEventListener('mouseover', () => {
rightAlignElem.iconOnly = false;
});
@@ -20,6 +31,15 @@ function roundedRightAlignExample() {
rightAlignElem.addEventListener('mouseout', () => {
rightAlignElem.iconOnly = true;
});
+
+ // The focusin and focusout events are to simulate toggling text for keyboard users
+ rightAlignElem.addEventListener('focusin', () => {
+ rightAlignElem.iconOnly = false;
+ });
+
+ rightAlignElem.addEventListener('focusout', () => {
+ rightAlignElem.iconOnly = true;
+ });
}
function initButtonApiExamples(initCount) {
diff --git a/docs/partials/api.md b/docs/partials/api.md
index 6895832..e827eef 100644
--- a/docs/partials/api.md
+++ b/docs/partials/api.md
@@ -182,7 +182,7 @@ A `rounded` `auro-button` with text only.
#### Toggle Text
-The `rounded` attribute supports the ability to hide/show the text of the `auro-button`. This can be done by changing the value of the `iconOnly` attribute. In this example, the text is toggled via `mouseover` and `mouseout` events.
+The `rounded` attribute supports the ability to hide/show the text of the `auro-button`. This can be done by changing the value of the `iconOnly` attribute. In this example, the text is toggled via `mouseover` and `mouseout` events. The `focusin` and `focusout` events simulate toggling text for keyboard users.
@@ -202,7 +202,7 @@ The `rounded` attribute supports the ability to hide/show the text of the `auro-
#### Right Aligned
-This example shows a `rounded` `auro-button` that is right-aligned, demonstrating how the button starts from the right and grows/shrinks from right to left when using the `toggleText` attribute in conjuction with the `mouseover` and `mouseout` events.
+This example shows a `rounded` `auro-button` that is right-aligned, demonstrating how the button starts from the right and grows/shrinks from right to left when using the `toggleText` attribute in conjuction with the `mouseover` and `mouseout` events. The `focusin` and `focusout` events simulate toggling text for keyboard users.