+24
-3
lines changedFilter options
+24
-3
lines changed Original file line number Diff line number Diff line change
@@ -107,6 +107,7 @@ const props = makePropsConfigurable(
107
107
// Handy if using <select> as the input
108
108
addOnChange: makeProp(PROP_TYPE_BOOLEAN, false),
109
109
duplicateTagText: makeProp(PROP_TYPE_STRING, 'Duplicate tag(s)'),
110
+
feedbackAriaLive: makeProp(PROP_TYPE_STRING, 'assertive'),
110
111
// Disable the input focus behavior when clicking
111
112
// on element matching the selector (or selectors)
112
113
ignoreInputFocusSelector: makeProp(PROP_TYPE_ARRAY_STRING, DEFAULT_INPUT_FOCUS_SELECTOR),
@@ -660,7 +661,7 @@ export const BFormTags = /*#__PURE__*/ Vue.extend({
660
661
if (invalidTagText || duplicateTagText || limitTagsText) {
661
662
// Add an aria live region for the invalid/duplicate tag
662
663
// messages if the user has not disabled the messages
663
-
const joiner = this.computedJoiner
664
+
const { feedbackAriaLive: ariaLive, computedJoiner: joiner } = this
664
665
665
666
// Invalid tag feedback if needed (error)
666
667
let $invalid = h()
@@ -670,6 +671,7 @@ export const BFormTags = /*#__PURE__*/ Vue.extend({
670
671
{
671
672
props: {
672
673
id: invalidFeedbackId,
674
+
ariaLive,
673
675
forceShow: true
674
676
},
675
677
key: 'tags_invalid_feedback'
@@ -684,7 +686,10 @@ export const BFormTags = /*#__PURE__*/ Vue.extend({
684
686
$duplicate = h(
685
687
BFormText,
686
688
{
687
-
props: { id: duplicateFeedbackId },
689
+
props: {
690
+
id: duplicateFeedbackId,
691
+
ariaLive
692
+
},
688
693
key: 'tags_duplicate_feedback'
689
694
},
690
695
[this.duplicateTagText, ': ', this.duplicateTags.join(joiner)]
@@ -697,7 +702,10 @@ export const BFormTags = /*#__PURE__*/ Vue.extend({
697
702
$limit = h(
698
703
BFormText,
699
704
{
700
-
props: { id: limitFeedbackId },
705
+
props: {
706
+
id: limitFeedbackId,
707
+
ariaLive
708
+
},
701
709
key: 'tags_limit_feedback'
702
710
},
703
711
[limitTagsText]
Original file line number Diff line number Diff line change
@@ -447,6 +447,8 @@ describe('form-tags', () => {
447
447
// Duplicate tags
448
448
expect(wrapper.emitted('tag-state')[3][2]).toEqual([])
449
449
expect(wrapper.find('.invalid-feedback').exists()).toBe(true)
450
+
expect(wrapper.find('.invalid-feedback').attributes('aria-live')).toEqual('assertive')
451
+
expect(wrapper.find('.invalid-feedback').attributes('aria-atomic')).toEqual('true')
450
452
expect(wrapper.find('.form-text').exists()).toBe(false)
451
453
// Add next character
452
454
$input.element.value = 'three '
@@ -478,6 +480,7 @@ describe('form-tags', () => {
478
480
479
481
$input.element.value = ' three two '
480
482
await $input.trigger('input')
483
+
await wrapper.setProps({ feedbackAriaLive: 'polite' })
481
484
expect(wrapper.vm.tags).toEqual(['one', 'two', 'tag'])
482
485
// No tags(s) were accepted so the input is left as is
483
486
expect(wrapper.vm.newTag).toEqual(' three two ')
@@ -489,13 +492,18 @@ describe('form-tags', () => {
489
492
// Duplicate tags
490
493
expect(wrapper.emitted('tag-state')[5][2]).toEqual(['two'])
491
494
expect(wrapper.find('.invalid-feedback').exists()).toBe(true)
495
+
expect(wrapper.find('.invalid-feedback').attributes('aria-live')).toEqual('polite')
496
+
expect(wrapper.find('.invalid-feedback').attributes('aria-atomic')).toEqual('true')
492
497
expect(wrapper.find('.form-text').exists()).toBe(true)
493
498
await $input.trigger('input')
499
+
await wrapper.setProps({ feedbackAriaLive: null })
494
500
expect(wrapper.vm.tags).toEqual(['one', 'two', 'tag'])
495
501
// No tags(s) were accepted so the input is left as is
496
502
expect(wrapper.vm.newTag).toEqual(' three two ')
497
503
expect(wrapper.emitted('tag-state').length).toBe(6)
498
504
expect(wrapper.find('.invalid-feedback').exists()).toBe(true)
505
+
expect(wrapper.find('.invalid-feedback').attributes('aria-live')).toBeUndefined()
506
+
expect(wrapper.find('.invalid-feedback').attributes('aria-atomic')).toBeUndefined()
499
507
expect(wrapper.find('.form-text').exists()).toBe(true)
500
508
501
509
$input.element.value = ' '
Original file line number Diff line number Diff line change
@@ -29,6 +29,11 @@
29
29
"prop": "duplicateTagText",
30
30
"description": "The message when duplicate tags are detected. Set to an empty string to disable the message"
31
31
},
32
+
{
33
+
"prop": "feedbackAriaLive",
34
+
"version": "2.22.0",
35
+
"description": "Value to use for the `aria-live` attribute on the feedback text"
36
+
},
32
37
{
33
38
"prop": "ignoreInputFocusSelector",
34
39
"version": "2.16.0",
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4