Skip to content

Commit a8ff2ed

Browse files
committed
fix: set icon focusable="false" #1358
1 parent dce2dea commit a8ff2ed

File tree

1 file changed

+1
-78
lines changed

1 file changed

+1
-78
lines changed

components/icon/index.js

Lines changed: 1 addition & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ function renderIcon(h, locale, context) {
115115
);
116116
innerNode = (
117117
<VueIcon
118+
focusable="false"
118119
class={svgClassString}
119120
type={computedType}
120121
primaryColor={twoToneColor}
@@ -163,84 +164,6 @@ const Icon = {
163164
scopedSlots={{ default: locale => renderIcon(h, locale, context) }}
164165
/>
165166
);
166-
167-
const classString = classNames({
168-
...getClass(context),
169-
[`anticon`]: true,
170-
[`anticon-${type}`]: !!type,
171-
});
172-
173-
const svgClassString = classNames({
174-
[`anticon-spin`]: !!spin || type === 'loading',
175-
});
176-
177-
let innerNode;
178-
179-
// component > children > type
180-
if (Component) {
181-
const innerSvgProps = {
182-
attrs: {
183-
...svgBaseProps,
184-
viewBox,
185-
},
186-
class: svgClassString,
187-
};
188-
if (!viewBox) {
189-
delete innerSvgProps.attrs.viewBox;
190-
}
191-
192-
innerNode = <Component {...innerSvgProps}>{children}</Component>;
193-
}
194-
if (children) {
195-
warning(
196-
Boolean(viewBox) || (children.length === 1 && children[0].tag === 'use'),
197-
'Make sure that you provide correct `viewBox`' +
198-
' prop (default `0 0 1024 1024`) to the icon.',
199-
);
200-
const innerSvgProps = {
201-
attrs: {
202-
...svgBaseProps,
203-
},
204-
class: svgClassString,
205-
};
206-
innerNode = (
207-
<svg {...innerSvgProps} viewBox={viewBox}>
208-
{children}
209-
</svg>
210-
);
211-
}
212-
213-
if (typeof type === 'string') {
214-
let computedType = type;
215-
if (theme) {
216-
const themeInName = getThemeFromTypeName(type);
217-
warning(
218-
!themeInName || theme === themeInName,
219-
`The icon name '${type}' already specify a theme '${themeInName}',` +
220-
` the 'theme' prop '${theme}' will be ignored.`,
221-
);
222-
}
223-
computedType = withThemeSuffix(
224-
removeTypeTheme(alias(computedType)),
225-
dangerousTheme || theme || defaultTheme,
226-
);
227-
innerNode = (
228-
<VueIcon
229-
focusable="false"
230-
class={svgClassString}
231-
type={computedType}
232-
primaryColor={twoToneColor}
233-
/>
234-
);
235-
}
236-
// functional component not support nativeOn,https://github.com/vuejs/vue/issues/7526
237-
const iProps = {
238-
...data,
239-
on: { ...listeners, ...data.nativeOn },
240-
class: classString,
241-
staticClass: '',
242-
};
243-
return <i {...iProps}>{innerNode}</i>;
244167
},
245168
};
246169

0 commit comments

Comments
 (0)