diff --git a/app/assets/javascripts/vue_shared/components/icon.vue b/app/assets/javascripts/vue_shared/components/icon.vue index e7ff76c8218..3cf90b45a97 100644 --- a/app/assets/javascripts/vue_shared/components/icon.vue +++ b/app/assets/javascripts/vue_shared/components/icon.vue @@ -75,6 +75,12 @@ export default { required: false, default: null, }, + + tabIndex: { + type: String, + required: false, + default: null, + }, }, computed: { @@ -98,6 +104,7 @@ export default { :height="height" :x="x" :y="y" + :tabindex="tabIndex" > diff --git a/changelogs/unreleased/kp-6927-epic-dates-from-milestone.yml b/changelogs/unreleased/kp-6927-epic-dates-from-milestone.yml new file mode 100644 index 00000000000..c15d73a0c12 --- /dev/null +++ b/changelogs/unreleased/kp-6927-epic-dates-from-milestone.yml @@ -0,0 +1,5 @@ +--- +title: Add 'tabindex' attribute support on Icon component to show BS4 popover on trigger type 'focus' +merge_request: 21066 +author: +type: other diff --git a/spec/javascripts/vue_shared/components/icon_spec.js b/spec/javascripts/vue_shared/components/icon_spec.js index 882420e602e..01f4649339e 100644 --- a/spec/javascripts/vue_shared/components/icon_spec.js +++ b/spec/javascripts/vue_shared/components/icon_spec.js @@ -13,6 +13,7 @@ describe('Sprite Icon Component', function () { name: 'commit', size: 32, cssClasses: 'extraclasses', + tabIndex: '0', }); }); @@ -58,5 +59,9 @@ describe('Sprite Icon Component', function () { it('`name` validator should return false for existing icons', () => { expect(Icon.props.name.validator('commit')).toBe(true); }); + + it('should contain `tabindex` attribute on svg element when `tabIndex` prop is defined', () => { + expect(icon.$el.getAttribute('tabindex')).toBe('0'); + }); }); });