Skip to content

Commit a711bb7

Browse files
authored
Merge pull request #5 from geospatialem/geospatialem/feat-expand
feat: dark mode contrast, docs, popup timings
2 parents d70651e + fefa9f2 commit a711bb7

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ Presented at the 2025 Esri Developer Summit by Kelly Hutchins and Kitty Hurley o
1111
1. [Map Description and Live Regions](demos/description-region/index.html)
1212
- Provide context to when the map has loaded and include a description when the map is in focus to further WCAG's [1.3.1: Info and Relationships](https://www.w3.org/WAI/WCAG22/Understanding/info-and-relationships.html) Success Criterion.
1313
2. [Expand Component Focus Trap Disabled](demos/expand-component/index.html)
14-
- Provide users the ability to not be trapped when interacting with the Expand component to further WCAG's [2.1.2: No Keyboard Trap](https://www.w3.org/WAI/WCAG21/Understanding/no-keyboard-trap.html) Success Criterion.
14+
- Provide users the ability to not be trapped when interacting with `arcgis-expand` to further WCAG's [2.1.2: No Keyboard Trap](https://www.w3.org/WAI/WCAG21/Understanding/no-keyboard-trap.html) Success Criterion. Also includes support with Calcite's focus for [1.4.3: Contrast (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum.html) and keyboard support with [2.4.3: Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) and [3.2.3: Consistent Navigation](https://www.w3.org/WAI/WCAG22/Understanding/consistent-navigation.html) Success Criterion.
1515
3. Consistent Focus 🚧
1616
- Provide a consistent focus order throughout your UI supporting WCAG's [2.4.3: Focus Order](https://www.w3.org/WAI/WCAG22/Understanding/focus-order.html) and [3.2.3: Consistent Navigation](https://www.w3.org/WAI/WCAG22/Understanding/consistent-navigation.html) Success Criterion.
1717
4. [High Contrast](demos/high-contrast/index.html)
1818
- Explore contrast with your data, altering the basemap and layer effects to support the map's purpose when a user has enabled high contrast on their operating system, also supporting WCAG's [1.4.3: Contrast Minimum](https://www.w3.org/WAI/WCAG22/Understanding/contrast-minimum) Success Criterion.
19-
5. [Reduced MotioN](demos/reduced-motion/index.html)
19+
5. [Reduced Motion](demos/reduced-motion/index.html)
2020
- Support reduced motion when a user has enabled reduced motion, or disabled animations on their operating system, also supporting WCAG's [2.3.3: Animation from Interactions](https://www.w3.org/WAI/WCAG22/Understanding/animation-from-interactions.html) Success Criterion.
2121

2222
## Resources

demos/expand-component/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,19 @@ require([
1717
// Resource: https://developers.arcgis.com/javascript/latest/watch-for-changes/#watch-for-changes-in-the-api
1818
mapEl.addEventListener("arcgisViewReadyChange", () => {
1919
reactiveUtils.watch(() => mapEl.view.popup.visible, (visible) => {
20+
// Wait for the popup to display and set its focus
21+
// Also... wait for the popup to close to set the arcgis-search focus
2022
if (mapEl.view.popup.visible) {
2123
setTimeout(() => {
2224
mapEl.view.popup.focus();
23-
}, 100);
25+
}, 500);
2426
} else {
2527
searchEl.focusSearch();
2628
}
2729
}
2830
);
2931
});
3032

31-
3233
// Initialize the mutation observer
3334
// Resource: https://developers.arcgis.com/javascript/latest/watch-for-changes/#using-a-mutation-observer
3435
const observer = new MutationObserver((mutations, observer) => {
@@ -59,6 +60,7 @@ require([
5960
lightModeCss.disabled = isDarkMode;
6061
toggleModeEl.icon = isDarkMode ? "moon" : "brightness";
6162
document.body.className = isDarkMode ? "calcite-mode-dark" : "";
63+
mapEl.basemap = isDarkMode ? "dark-gray" : "gray";
6264

6365
document.querySelectorAll(`.calcite-mode-${isDarkMode ? "light" : "dark"}`).forEach(node =>
6466
node.classList.replace(`calcite-mode-${isDarkMode ? "light" : "dark"}`, `calcite-mode-${mode}`)

demos/expand-component/style.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@ calcite-shell-panel[slot="panel-start"] calcite-panel {
2121

2222
/* Custom styling using Calcite's semantic tokens */
2323
/* Resource: https://developers.arcgis.com/calcite-design-system/foundations/tokens/usage */
24-
:root,
24+
25+
/* Light mode */
26+
body,
2527
:focus {
2628
--calcite-color-brand: #000;
2729
--calcite-color-focus: var(--calcite-color-brand);
30+
}
31+
32+
/* Dark mode */
33+
body.calcite-mode-dark,
34+
.calcite-mode-dark :focus {
35+
--calcite-color-brand: #FEFE4D;
36+
--calcite-color-focus: var(--calcite-color-brand);
2837
}

0 commit comments

Comments
 (0)