mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Popover): improve a11y (#7624)
This commit is contained in:
parent
1f5f078aec
commit
89ce8345b4
@ -114,13 +114,14 @@ export default createComponent({
|
|||||||
renderAction(action, index) {
|
renderAction(action, index) {
|
||||||
const { icon, text, disabled, className } = action;
|
const { icon, text, disabled, className } = action;
|
||||||
return (
|
return (
|
||||||
<div
|
<button
|
||||||
|
type="button"
|
||||||
class={[bem('action', { disabled, 'with-icon': icon }), className]}
|
class={[bem('action', { disabled, 'with-icon': icon }), className]}
|
||||||
onClick={() => this.onClickAction(action, index)}
|
onClick={() => this.onClickAction(action, index)}
|
||||||
>
|
>
|
||||||
{icon && <Icon name={icon} class={bem('action-icon')} />}
|
{icon && <Icon name={icon} class={bem('action-icon')} />}
|
||||||
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
|
<div class={[bem('action-text'), BORDER_BOTTOM]}>{text}</div>
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -34,6 +34,8 @@
|
|||||||
padding: 0 @padding-md;
|
padding: 0 @padding-md;
|
||||||
font-size: @popover-action-font-size;
|
font-size: @popover-action-font-size;
|
||||||
line-height: @line-height-md;
|
line-height: @line-height-md;
|
||||||
|
background-color: transparent;
|
||||||
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`should allow to custom the className of action 1`] = `
|
exports[`should allow to custom the className of action 1`] = `
|
||||||
<div class="van-popover__action foo">
|
<button type="button" class="van-popover__action foo">
|
||||||
<div class="van-popover__action-text van-hairline--bottom">Option</div>
|
<div class="van-popover__action-text van-hairline--bottom">Option</div>
|
||||||
</div>
|
</button>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`should locate to reference element when showed 1`] = `<!---->`;
|
exports[`should locate to reference element when showed 1`] = `<!---->`;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user