gd-bs 6.2.5 → 6.2.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/generateIcons.js CHANGED
@@ -150,6 +150,8 @@ fs.readdir(dirIcons, function (err, files) {
150
150
  '\t icon.classList.add(classNames[i]);',
151
151
  '\t }',
152
152
  '\t }\n',
153
+ '\t // Make this icon invisible to the screen reader',
154
+ '\t icon.setAttribute("aria-hidden", "true");\n',
153
155
  '\t // Set the height/width',
154
156
  '\t icon.setAttribute("height", (height ? height : 32).toString());',
155
157
  '\t icon.setAttribute("width", (width ? width : 32).toString());\n',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gd-bs",
3
- "version": "6.2.5",
3
+ "version": "6.2.7",
4
4
  "description": "Bootstrap JavaScript, TypeScript and Web Components library.",
5
5
  "main": "build/index.js",
6
6
  "typings": "src/index.d.ts",
@@ -36,7 +36,7 @@
36
36
  "@popperjs/core": "^2.11.8",
37
37
  "bootstrap": "^5.3.1",
38
38
  "bootstrap-icons": "^1.10.5",
39
- "core-js": "^3.32.0",
39
+ "core-js": "^3.32.1",
40
40
  "tippy.js": "^6.3.7"
41
41
  },
42
42
  "devDependencies": {
package/pnpm-lock.yaml CHANGED
@@ -2,7 +2,7 @@ dependencies:
2
2
  '@popperjs/core': 2.11.8
3
3
  bootstrap: 5.3.1_@popperjs+core@2.11.8
4
4
  bootstrap-icons: 1.10.5
5
- core-js: 3.32.0
5
+ core-js: 3.32.1
6
6
  tippy.js: 6.3.7
7
7
  devDependencies:
8
8
  '@babel/core': 7.19.3
@@ -1834,11 +1834,11 @@ packages:
1834
1834
  dev: true
1835
1835
  resolution:
1836
1836
  integrity: sha512-ovcyhs2DEBUIE0MGEKHP4olCUW/XYte3Vroyxuh38rD1wAO4dHohsovUC4eAOuzFxE6b+RXvBU3UZ9o0YhUTkA==
1837
- /core-js/3.32.0:
1837
+ /core-js/3.32.1:
1838
1838
  dev: false
1839
1839
  requiresBuild: true
1840
1840
  resolution:
1841
- integrity: sha512-rd4rYZNlF3WuoYuRIDEmbR/ga9CeuWX9U05umAvgrrZoHY4Z++cp/xwPQMvUpBB4Ag6J8KfD80G0zwCyaSxDww==
1841
+ integrity: sha512-lqufgNn9NLnESg5mQeYsxQP5w7wrViSj0jr/kv6ECQiByzQkrn1MKvV0L3acttpDqfQrHLwr2KCMgX5b8X+lyQ==
1842
1842
  /cosmiconfig/8.2.0:
1843
1843
  dependencies:
1844
1844
  import-fresh: 3.3.0
@@ -3284,7 +3284,7 @@ specifiers:
3284
3284
  babel-loader: ^9.1.2
3285
3285
  bootstrap: ^5.3.1
3286
3286
  bootstrap-icons: ^1.10.5
3287
- core-js: ^3.32.0
3287
+ core-js: ^3.32.1
3288
3288
  css-loader: ^6.7.3
3289
3289
  dts-bundle: ^0.7.3
3290
3290
  postcss-loader: ^7.3.3
@@ -84,6 +84,10 @@ class _Button extends Base<IButtonProps> implements IButton {
84
84
  // Set the default type
85
85
  this.setType(this.props.type || ButtonTypes.Primary)
86
86
 
87
+ // Set the aria label/description
88
+ this.props.description ? this.el.setAttribute("aria-description", this.props.description) : null;
89
+ this.el.setAttribute("aria-label", this.props.label || this.props.text);
90
+
87
91
  // Set the attributes
88
92
  this.props.dismiss ? this.el.setAttribute("data-bs-dismiss", this.props.dismiss) : null;
89
93
  this.props.href ? this.el.href = this.props.href : null;
@@ -86,6 +86,7 @@ export interface IButtonProps extends IBaseProps<IButton> {
86
86
  badge?: IBadgeProps;
87
87
  controls?: string | Array<string>;
88
88
  data?: any;
89
+ description?: string;
89
90
  dismiss?: string;
90
91
  href?: string;
91
92
  iconClassName?: string;
@@ -98,6 +99,7 @@ export interface IButtonProps extends IBaseProps<IButton> {
98
99
  isLarge?: boolean;
99
100
  isLink?: boolean;
100
101
  isSmall?: boolean;
102
+ label?: string;
101
103
  onClick?: (button?: IButtonProps, ev?: Event) => void;
102
104
  spinnerProps?: ISpinnerProps;
103
105
  tabIndex?: number;
@@ -124,6 +124,7 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
124
124
  if (toggle) {
125
125
  toggle.classList.add(btnType);
126
126
  toggle.disabled = this.props.isReadonly ? true : false;
127
+ toggle.setAttribute("aria-label", this.props.label || "");
127
128
  }
128
129
 
129
130
  // See if we are rendering the menu only
@@ -509,6 +510,7 @@ class _Dropdown extends Base<IDropdownProps> implements IDropdown {
509
510
  if (ddl) {
510
511
  // Set the inner html
511
512
  ddl.innerHTML = value;
513
+ ddl.setAttribute("aria-label", value);
512
514
  }
513
515
  }
514
516
 
@@ -71,6 +71,12 @@ class _Tooltip extends Base<ITooltipProps> {
71
71
  let btnProps = this.props.btnProps || {};
72
72
  btnProps.type = btnProps.type || ButtonTypes.OutlineSecondary
73
73
 
74
+ // See if the content is text
75
+ if (typeof (this.props.content) === "string") {
76
+ // Set the label
77
+ btnProps.description = this.props.content;
78
+ }
79
+
74
80
  // Create the button
75
81
  this._btn = Button(btnProps);
76
82
 
@@ -332,6 +338,12 @@ class _Tooltip extends Base<ITooltipProps> {
332
338
  setContent(content: string | Element) {
333
339
  // Set the tippy content
334
340
  this.tippy.setContent(content);
341
+
342
+ // See if the button exists
343
+ if (this._btn && typeof (content) === "string") {
344
+ // Update the content
345
+ this._btn.el.setAttribute("aria-description", content);
346
+ }
335
347
  }
336
348
 
337
349
  // Shows the tooltip
@@ -15,6 +15,9 @@ export const generateIcon = (svg: string, height: number = 32, width: number = 3
15
15
  }
16
16
  }
17
17
 
18
+ // Make this icon invisible to the screen reader
19
+ icon.setAttribute("aria-hidden", "true");
20
+
18
21
  // Set the height/width
19
22
  icon.setAttribute("height", (height ? height : 32).toString());
20
23
  icon.setAttribute("width", (width ? width : 32).toString());