@sbc-connect/nuxt-base 0.13.0 → 0.13.2

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
@@ -1,5 +1,17 @@
1
1
  # @sbc-connect/nuxt-base
2
2
 
3
+ ## 0.13.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#190](https://github.com/bcgov/connect-nuxt/pull/190) [`4a4846b`](https://github.com/bcgov/connect-nuxt/commit/4a4846b53acb28b5a77cca8f9fb67393ba0132f9) Thanks [@eve-git](https://github.com/eve-git)! - Fix Tab order in Safari skipping the date picker calendar's month/year navigation buttons, and report date input changes to form validation as the user types instead of only on blur
8
+
9
+ ## 0.13.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [#188](https://github.com/bcgov/connect-nuxt/pull/188) [`6b06486`](https://github.com/bcgov/connect-nuxt/commit/6b06486d052dea23764c696d297f727bb5ad8a6e) Thanks [@eve-git](https://github.com/eve-git)! - Fix Tab focus not reaching the date picker's clear and calendar buttons in Safari
14
+
3
15
  ## 0.13.0
4
16
 
5
17
  ### Minor Changes
@@ -26,11 +26,11 @@ const props = defineProps<{
26
26
  const { locale } = useI18n()
27
27
 
28
28
  // wires the input up to the wrapping UFormField (if any): aria-describedby/
29
- // aria-invalid derived from its help/error text, and blur reported onto the
30
- // form's validation bus. Calling this here (rather than leaving it to the
29
+ // aria-invalid derived from its help/error text, and blur/input reported onto
30
+ // the form's validation bus. Calling this here (rather than leaving it to the
31
31
  // inner UInput) makes the relationship explicit and independent of UInput's
32
32
  // own internal wiring.
33
- const { ariaAttrs, emitFormBlur } = useFormField()
33
+ const { ariaAttrs, emitFormBlur, emitFormInput } = useFormField()
34
34
 
35
35
  const dateModel = defineModel<string>()
36
36
 
@@ -154,7 +154,20 @@ function onDateSelect(date: DateValue | DateRange | DateValue[] | null | undefin
154
154
  })
155
155
  }
156
156
 
157
+ // Reka UI's Calendar.Prev/Calendar.Next header buttons render as plain
158
+ // <button>s with no tabindex, same as the trailing icon buttons above -
159
+ // Safari excludes them from Tab order by default, so without this, Tab skips
160
+ // straight past prev-month/next-month/next-year into the day grid
161
+ function fixHeaderButtonTabOrder() {
162
+ nextTick(() => {
163
+ calendarContentRef.value
164
+ ?.querySelectorAll<HTMLElement>('[data-slot="header"] button')
165
+ .forEach(button => button.setAttribute('tabindex', '0'))
166
+ })
167
+ }
168
+
157
169
  function onOpenAutoFocus(e: Event) {
170
+ fixHeaderButtonTabOrder()
158
171
  if (calendarOpenedViaInput) {
159
172
  e.preventDefault()
160
173
  calendarOpenedViaInput = false
@@ -233,6 +246,10 @@ watch(dateInput, (val: string) => {
233
246
  // sync immediately so the parent (and its schema validation) always sees the
234
247
  // current value instead of waiting for the debounced auto-formatting below
235
248
  syncModelFromLocal()
249
+ // report the change onto the form's validation bus as it's typed, rather than
250
+ // only on blur - emitFormInput() is always eager here (see useFormField), so
251
+ // this revalidates on every keystroke instead of waiting for a first blur
252
+ emitFormInput()
236
253
 
237
254
  clearTimeout(debounceTimer)
238
255
  if (!val) {
@@ -280,15 +297,23 @@ function clearDate() {
280
297
  {{ label }}
281
298
  </label>
282
299
  <template #trailing>
300
+ <!-- explicit tabindex="0" on both trailing buttons: Safari excludes plain
301
+ <button> elements from Tab order by default (unlike Chrome/Firefox), so
302
+ without this, Tab skips straight past them from the date input -->
303
+ <!-- .stop on both Enter handlers below: type="button" already blocks native
304
+ form submission, but consuming apps may wrap this in a dialog/form with its
305
+ own "Enter activates primary action" keydown listener higher up the tree -
306
+ stopping propagation keeps Enter fully local to whichever icon is focused -->
283
307
  <UButton
284
308
  v-if="dateInput && !disabled"
285
309
  icon="i-mdi-close"
286
310
  type="button"
311
+ tabindex="0"
287
312
  :color="error ? 'error' : 'neutral'"
288
313
  variant="ghost"
289
314
  class="date-action-button"
290
315
  :aria-label="$t('label.clearDate')"
291
- @keydown.enter.prevent="clearDate"
316
+ @keydown.enter.prevent.stop="clearDate"
292
317
  @click="clearDate"
293
318
  />
294
319
  <!-- capture Enter before Reka UI asChild trigger strips the listener -->
@@ -307,12 +332,13 @@ function clearDate() {
307
332
  <UButton
308
333
  icon="i-mdi-calendar"
309
334
  type="button"
335
+ tabindex="0"
310
336
  :disabled="disabled"
311
337
  :color="error && !dateInput ? 'error' : 'neutral'"
312
338
  variant="ghost"
313
339
  class="date-action-button"
314
340
  :aria-label="$t('label.openCalendar')"
315
- @keydown.enter.prevent="isCalendarOpen = !isCalendarOpen"
341
+ @keydown.enter.prevent.stop="isCalendarOpen = !isCalendarOpen"
316
342
  />
317
343
  <template #content>
318
344
  <div ref="calendarContentRef">
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sbc-connect/nuxt-base",
3
3
  "type": "module",
4
- "version": "0.13.0",
4
+ "version": "0.13.2",
5
5
  "repository": "github:bcgov/connect-nuxt",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "./nuxt.config.ts",