accessible-kit 1.0.6 → 1.0.7

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/CHANGELOG.md CHANGED
@@ -5,6 +5,25 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.7] - 2026-01-26
9
+
10
+ ### Changed
11
+ - **All Components - Focus Indicator Improvements**: Migrated from `:focus` to `:focus-visible` for better keyboard navigation UX
12
+ - **Breaking Change for Custom Themes**: If you have custom theme files, update `:focus` selectors to `:focus-visible`
13
+ - **Complete separation of concerns**: ALL visual styling (including `outline` properties) moved from `*.core.css` to `*.theme.css` files
14
+ - Core CSS files now contain ZERO visual styling - only structural layout and behavior
15
+ - Theme CSS files contain all focus styling including `outline`, `outline-offset`, and `outline-color`
16
+ - **Benefits**:
17
+ - Focus indicators only appear for keyboard navigation, not on mouse clicks
18
+ - Perfect separation between core functionality and visual design
19
+ - Complete customization freedom - modify or remove all focus styling in theme files
20
+ - No hardcoded visual defaults in core files
21
+ - **Affected components**: Dropdown, Modal, Offcanvas, Tabs, Accordion
22
+ - **Migration guide**:
23
+ - Update your custom theme `:focus` selectors to `:focus-visible`
24
+ - All `outline` customization should now be done in `*.theme.css` files only
25
+ - Updated documentation in README with focus-visible information
26
+
8
27
  ## [1.0.6] - 2026-01-15
9
28
 
10
29
  ### Added
@@ -152,6 +171,7 @@ document.addEventListener('DOMContentLoaded', () => {
152
171
  - Zero dependencies
153
172
  - Full TypeScript-ready exports
154
173
 
174
+ [1.0.7]: https://github.com/5ulo/accessible-kit/compare/v1.0.6...v1.0.7
155
175
  [1.0.6]: https://github.com/5ulo/accessible-kit/compare/v1.0.5...v1.0.6
156
176
  [1.0.5]: https://github.com/5ulo/accessible-kit/compare/v1.0.4...v1.0.5
157
177
  [1.0.4]: https://github.com/5ulo/accessible-kit/compare/v1.0.3...v1.0.4
package/README.md CHANGED
@@ -19,6 +19,7 @@ A collection of fully accessible UI components for modern web applications. Buil
19
19
  - **♿ Inclusive** - High contrast mode and reduced motion support
20
20
  - **🔧 Framework Agnostic** - Works with any framework or vanilla JS
21
21
  - **📦 Tree-shakeable** - Import only what you need
22
+ - **⌨️ Focus Visible** - Uses `:focus-visible` for better keyboard navigation UX
22
23
 
23
24
  ## 📚 Table of Contents
24
25
 
@@ -1055,6 +1056,7 @@ Contains only logic, positioning, layout, and behavior:
1055
1056
  - Visibility states
1056
1057
  - Animations
1057
1058
  - Responsive breakpoints
1059
+ - **NO visual styling** - completely theme-agnostic
1058
1060
 
1059
1061
  **Do not modify** unless changing component functionality.
1060
1062
 
@@ -1066,6 +1068,7 @@ Contains all visual styling:
1066
1068
  - Typography
1067
1069
  - Borders and border-radius
1068
1070
  - Shadows
1071
+ - **All focus indicators** (`:focus-visible` with `outline`, `outline-offset`, etc.)
1069
1072
  - Dark mode
1070
1073
  - High contrast mode
1071
1074
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accessible-kit",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Lightweight, accessible UI component library with full ARIA support. Zero dependencies, vanilla JavaScript.",
5
5
  "main": "src/js/index.js",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  background: #f9fafb;
32
32
  }
33
33
 
34
- [data-accordion-trigger]:focus {
34
+ [data-accordion-trigger]:focus-visible {
35
35
  outline: 2px solid #3b82f6;
36
36
  outline-offset: -2px;
37
37
  }
@@ -78,7 +78,7 @@
78
78
  background: #2563eb;
79
79
  }
80
80
 
81
- [data-accordion-toggle]:focus {
81
+ [data-accordion-toggle]:focus-visible {
82
82
  outline: 2px solid #3b82f6;
83
83
  outline-offset: 2px;
84
84
  }
@@ -112,7 +112,7 @@
112
112
  border-color: #d1d5db;
113
113
  }
114
114
 
115
- [data-accordion-toggle-all]:focus {
115
+ [data-accordion-toggle-all]:focus-visible {
116
116
  outline: 2px solid #3b82f6;
117
117
  outline-offset: 2px;
118
118
  }
@@ -214,7 +214,7 @@
214
214
  border-width: 2px;
215
215
  }
216
216
 
217
- [data-accordion-trigger]:focus {
217
+ [data-accordion-trigger]:focus-visible {
218
218
  outline-width: 3px;
219
219
  }
220
220
  }
@@ -16,10 +16,6 @@
16
16
  cursor: pointer;
17
17
  }
18
18
 
19
- [data-dropdown-button]:focus {
20
- outline-offset: 2px;
21
- }
22
-
23
19
  /* Button icon/arrow */
24
20
  [data-dropdown-arrow] {
25
21
  display: inline-block;
@@ -99,10 +95,6 @@
99
95
  text-decoration: none;
100
96
  }
101
97
 
102
- [data-dropdown-item]:focus {
103
- outline: none;
104
- }
105
-
106
98
  /* Divider */
107
99
  [data-dropdown-divider] {
108
100
  height: 1px;
@@ -130,9 +122,6 @@
130
122
  }
131
123
 
132
124
  /* Navigation variant */
133
- [data-dropdown][data-variant="nav"] [data-dropdown-button]:focus {
134
- outline-offset: 2px;
135
- }
136
125
 
137
126
  /* Language switcher variant */
138
127
  [data-dropdown][data-variant="language"] [data-dropdown-item] {
@@ -153,13 +142,6 @@
153
142
  }
154
143
  }
155
144
 
156
- /* High contrast mode support */
157
- @media (prefers-contrast: high) {
158
- [data-dropdown-item]:focus {
159
- outline-offset: -2px;
160
- }
161
- }
162
-
163
145
  /* Reduced motion support - disable animations */
164
146
  @media (prefers-reduced-motion: reduce) {
165
147
  [data-dropdown-menu]:not([data-no-animation]),
@@ -20,7 +20,7 @@
20
20
  border-color: #9ca3af;
21
21
  }
22
22
 
23
- [data-dropdown-button]:focus {
23
+ [data-dropdown-button]:focus-visible {
24
24
  outline: 2px solid #3b82f6;
25
25
  border-color: #3b82f6;
26
26
  }
@@ -61,9 +61,10 @@
61
61
  }
62
62
 
63
63
  [data-dropdown-item]:hover,
64
- [data-dropdown-item]:focus {
64
+ [data-dropdown-item]:focus-visible {
65
65
  background: #f3f4f6;
66
66
  color: #111827;
67
+ outline: none;
67
68
  }
68
69
 
69
70
  [data-dropdown-item]:active {
@@ -98,7 +99,7 @@
98
99
  background: rgba(0, 0, 0, 0.05);
99
100
  }
100
101
 
101
- [data-dropdown][data-variant="nav"] [data-dropdown-button]:focus {
102
+ [data-dropdown][data-variant="nav"] [data-dropdown-button]:focus-visible {
102
103
  outline: 2px solid currentColor;
103
104
  }
104
105
 
@@ -122,8 +123,9 @@
122
123
  border-width: 2px;
123
124
  }
124
125
 
125
- [data-dropdown-item]:focus {
126
+ [data-dropdown-item]:focus-visible {
126
127
  outline: 2px solid currentColor;
128
+ outline-offset: -2px;
127
129
  }
128
130
  }
129
131
 
@@ -160,9 +162,10 @@
160
162
  }
161
163
 
162
164
  [data-dropdown-item]:hover,
163
- [data-dropdown-item]:focus {
165
+ [data-dropdown-item]:focus-visible {
164
166
  background: #374151;
165
167
  color: #fff;
168
+ outline: none;
166
169
  }
167
170
 
168
171
  [data-dropdown-item]:active {
@@ -110,11 +110,6 @@ body.modal-open {
110
110
  overflow: hidden;
111
111
  }
112
112
 
113
- /* Focus trap */
114
- [data-modal-dialog]:focus {
115
- outline: none;
116
- }
117
-
118
113
  /* Responsive */
119
114
  @media (max-width: 640px) {
120
115
  [data-modal-dialog] {
@@ -16,6 +16,10 @@
16
16
  0 10px 10px -5px rgba(0, 0, 0, 0.04);
17
17
  }
18
18
 
19
+ [data-modal-dialog]:focus-visible {
20
+ outline: none;
21
+ }
22
+
19
23
  /* Modal header */
20
24
  [data-modal-header] {
21
25
  padding: 1.5rem;
@@ -66,7 +70,7 @@
66
70
  color: #111827;
67
71
  }
68
72
 
69
- [data-modal-close]:focus {
73
+ [data-modal-close]:focus-visible {
70
74
  outline: 2px solid #3b82f6;
71
75
  outline-offset: 2px;
72
76
  }
@@ -200,7 +204,7 @@
200
204
  border: 2px solid currentColor;
201
205
  }
202
206
 
203
- [data-modal-close]:focus {
207
+ [data-modal-close]:focus-visible {
204
208
  outline-width: 3px;
205
209
  }
206
210
  }
@@ -112,11 +112,6 @@ body.offcanvas-open {
112
112
  overflow: hidden;
113
113
  }
114
114
 
115
- /* Focus trap */
116
- [data-offcanvas-panel]:focus {
117
- outline: none;
118
- }
119
-
120
115
  /* Reduced motion support */
121
116
  @media (prefers-reduced-motion: reduce) {
122
117
  [data-offcanvas-panel],
@@ -2,6 +2,11 @@
2
2
  /* Obsahuje vizualne nastavenia: farby, velkosti, bordery, radiusy, spacing */
3
3
  /* Pre zmenu vzhladu upravte tento subor */
4
4
 
5
+ /* Focus visible for the panel itself (focus trap) */
6
+ [data-offcanvas-panel]:focus-visible {
7
+ outline: none;
8
+ }
9
+
5
10
  /* Focus visible for all focusable elements inside offcanvas */
6
11
  [data-offcanvas-panel] :focus-visible {
7
12
  outline: 2px solid #3b82f6;
@@ -46,10 +46,6 @@
46
46
  pointer-events: none;
47
47
  }
48
48
 
49
- [data-tabs-tab]:focus {
50
- outline-offset: -2px;
51
- }
52
-
53
49
  /* Tab panels container */
54
50
  [data-tabs-panels] {
55
51
  position: relative;
@@ -64,11 +60,6 @@
64
60
  display: block;
65
61
  }
66
62
 
67
- /* Focus within panel */
68
- [data-tabs-panel]:focus {
69
- outline: none;
70
- }
71
-
72
63
  /* View Transitions API uses default cross-fade animation */
73
64
  /* Customization via pseudo-elements */
74
65
  ::view-transition-old(root),
@@ -35,8 +35,9 @@
35
35
  background: #f9fafb;
36
36
  }
37
37
 
38
- [data-tabs-tab]:focus {
38
+ [data-tabs-tab]:focus-visible {
39
39
  outline: 2px solid #3b82f6;
40
+ outline-offset: -2px;
40
41
  color: #374151;
41
42
  }
42
43
 
@@ -80,6 +81,10 @@
80
81
  line-height: 1.6;
81
82
  }
82
83
 
84
+ [data-tabs-panel]:focus-visible {
85
+ outline: none;
86
+ }
87
+
83
88
  /* Boxed variant */
84
89
  [data-tabs][data-tabs][data-variant="boxed"] [data-tabs-list] {
85
90
  border-bottom: 1px solid #e5e7eb;
@@ -136,7 +141,7 @@
136
141
  color: #fff;
137
142
  }
138
143
 
139
- [data-tabs][data-tabs][data-variant="pills"] [data-tabs-tab]:focus {
144
+ [data-tabs][data-tabs][data-variant="pills"] [data-tabs-tab]:focus-visible {
140
145
  outline-color: #3b82f6;
141
146
  }
142
147
 
@@ -222,7 +227,7 @@
222
227
  border-width: 2px;
223
228
  }
224
229
 
225
- [data-tabs-tab]:focus {
230
+ [data-tabs-tab]:focus-visible {
226
231
  outline-width: 3px;
227
232
  }
228
233
  }
@@ -246,7 +251,7 @@
246
251
  background: #1f2937;
247
252
  }
248
253
 
249
- [data-tabs-tab]:focus {
254
+ [data-tabs-tab]:focus-visible {
250
255
  color: #f9fafb;
251
256
  }
252
257