A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/bootstrap-vue/bootstrap-vue/commit/72a13635b94aedfab1fb6800f2a297fa306f63ef below:

use `aria-label` attribute instead of `alt` (#5581) · bootstrap-vue/bootstrap-vue@72a1363 · GitHub

File tree Expand file treeCollapse file tree 4 files changed

+16

-11

lines changed

Filter options

Expand file treeCollapse file tree 4 files changed

+16

-11

lines changed Original file line number Diff line number Diff line change

@@ -52,7 +52,7 @@ const baseAttrs = {

52 52

height: '1em',

53 53

focusable: 'false',

54 54

role: 'img',

55 -

alt: 'icon'

55 +

'aria-label': 'icon'

56 56

}

57 57 58 58

// Attributes that are nulled out when stacked

@@ -61,7 +61,7 @@ const stackedAttrs = {

61 61

height: null,

62 62

focusable: null,

63 63

role: null,

64 -

alt: null

64 +

'aria-label': null

65 65

}

66 66 67 67

// Shared private base component to reduce bundle/runtime size

Original file line number Diff line number Diff line change

@@ -13,8 +13,9 @@ import { commonIconProps, BVIconBase } from './icon-base'

13 13

export const makeIcon = (name, content) => {

14 14

// For performance reason we pre-compute some values, so that

15 15

// they are not computed on each render of the icon component

16 +

const kebabName = kebabCase(name)

16 17

const iconName = `BIcon${pascalCase(name)}`

17 -

const iconNameClass = `bi-${kebabCase(name)}`

18 +

const iconNameClass = `bi-${kebabName}`

18 19

const svgContent = trim(content || '')

19 20

// Return the icon component definition

20 21

return /*#__PURE__*/ Vue.extend({

@@ -30,7 +31,11 @@ export const makeIcon = (name, content) => {

30 31

render(h, { data, props }) {

31 32

return h(

32 33

BVIconBase,

33 -

mergeData(data, { staticClass: iconNameClass, props: { ...props, content: svgContent } })

34 +

mergeData(data, {

35 +

staticClass: iconNameClass,

36 +

props: { ...props, content: svgContent },

37 +

attrs: { 'aria-label': kebabName.replace(/-/g, ' ') }

38 +

})

34 39

)

35 40

}

36 41

})

Original file line number Diff line number Diff line change

@@ -22,7 +22,7 @@ describe('icons', () => {

22 22

expect(wrapper.classes()).toContain('bi-alarm-fill')

23 23

expect(wrapper.classes().length).toBe(3)

24 24

expect(wrapper.attributes('role')).toBe('img')

25 -

expect(wrapper.attributes('alt')).toBe('icon')

25 +

expect(wrapper.attributes('aria-label')).toBe('alarm fill')

26 26

expect(wrapper.attributes('focusable')).toBe('false')

27 27

expect(wrapper.attributes('xmlns')).toBe('http://www.w3.org/2000/svg')

28 28

expect(wrapper.attributes('width')).toBe('1em')

@@ -54,7 +54,7 @@ describe('icons', () => {

54 54

expect(wrapper.classes()).toContain('bi-alarm-fill')

55 55

expect(wrapper.classes().length).toBe(3)

56 56

expect(wrapper.attributes('role')).not.toBe('img')

57 -

expect(wrapper.attributes('alt')).not.toBe('icon')

57 +

expect(wrapper.attributes('aria-label')).not.toBe('icon')

58 58

expect(wrapper.attributes('focusable')).not.toBe('false')

59 59

expect(wrapper.attributes('focusable')).not.toBe('true')

60 60

expect(wrapper.attributes('xmlns')).not.toBe('http://www.w3.org/2000/svg')

@@ -153,7 +153,7 @@ describe('icons', () => {

153 153

expect(wrapper.classes()).toContain('text-danger')

154 154

expect(wrapper.classes().length).toBe(4)

155 155

expect(wrapper.attributes('role')).toBe('img')

156 -

expect(wrapper.attributes('alt')).toBe('icon')

156 +

expect(wrapper.attributes('aria-label')).toBe('alarm fill')

157 157

expect(wrapper.attributes('focusable')).toBe('false')

158 158

expect(wrapper.find('svg > g').exists()).toBe(true)

159 159

expect(wrapper.find('svg > g').attributes('transform')).not.toBeDefined()

@@ -178,7 +178,7 @@ describe('icons', () => {

178 178

expect(wrapper.classes()).toContain('bi-alarm-fill')

179 179

expect(wrapper.classes().length).toBe(3)

180 180

expect(wrapper.attributes('role')).toBe('img')

181 -

expect(wrapper.attributes('alt')).toBe('icon')

181 +

expect(wrapper.attributes('aria-label')).toBe('alarm fill')

182 182

expect(wrapper.attributes('focusable')).toBe('false')

183 183

expect(wrapper.attributes('style')).toBeDefined()

184 184

expect(wrapper.element.style.fontSize).toEqual('125%')

Original file line number Diff line number Diff line change

@@ -12,7 +12,7 @@ describe('icons > b-iconstack', () => {

12 12

expect(wrapper.classes()).toContain('bi')

13 13

expect(wrapper.classes().length).toBe(3)

14 14

expect(wrapper.attributes('role')).toBe('img')

15 -

expect(wrapper.attributes('alt')).toBe('icon')

15 +

expect(wrapper.attributes('aria-label')).toBe('icon')

16 16

expect(wrapper.attributes('focusable')).toBe('false')

17 17

expect(wrapper.attributes('xmlns')).toBe('http://www.w3.org/2000/svg')

18 18

expect(wrapper.attributes('width')).toBe('1em')

@@ -43,7 +43,7 @@ describe('icons > b-iconstack', () => {

43 43

expect(wrapper.classes()).toContain('text-danger')

44 44

expect(wrapper.classes().length).toBe(4)

45 45

expect(wrapper.attributes('role')).toBe('img')

46 -

expect(wrapper.attributes('alt')).toBe('icon')

46 +

expect(wrapper.attributes('aria-label')).toBe('icon')

47 47

expect(wrapper.attributes('focusable')).toBe('false')

48 48

expect(wrapper.find('svg > g').exists()).toBe(true)

49 49

expect(wrapper.find('svg > g').attributes('transform')).not.toBeDefined()

@@ -65,7 +65,7 @@ describe('icons > b-iconstack', () => {

65 65

expect(wrapper.classes()).toContain('bi')

66 66

expect(wrapper.classes().length).toBe(3)

67 67

expect(wrapper.attributes('role')).toBe('img')

68 -

expect(wrapper.attributes('alt')).toBe('icon')

68 +

expect(wrapper.attributes('aria-label')).toBe('icon')

69 69

expect(wrapper.attributes('focusable')).toBe('false')

70 70

expect(wrapper.attributes('style')).toBeDefined()

71 71

expect(wrapper.element.style.fontSize).toEqual('125%')

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