Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(switch): 修复朗读不可用问题. (#1018) #1096

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/switch/switch.less
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
.@{prefix}-switch {
display: flex;
align-items: center;
overflow: hidden;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个样式是解决什么问题呀?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

读取区域会随着里面dot挪动


&__label {
position: absolute;
Expand Down Expand Up @@ -105,6 +106,7 @@
background-color: @switch-unchecked-color;
position: relative;
transition: all 0.3s ease;
overflow: hidden;

&--checked {
background-color: @switch-checked-color;
Expand Down
12 changes: 10 additions & 2 deletions src/switch/switch.wxml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<wxs src="../common/utils.wxs" module="_" />
<view style="{{ customStyle }}" class="{{ prefix }}-class {{classPrefix}}" bind:tap="handleSwitch">
<label
style="{{ customStyle }}"
class="{{ prefix }}-class {{classPrefix}}"
bind:tap="handleSwitch"
disabled="{{disabled}}"
aria-checked="{{checked}}"
aria-disabled="{{disabled}}"
aria-role="checkbox"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么是在label上设计aria-role=checkbox呀?

>
<view
class="{{_.cls(classPrefix + '__body', [['checked', checked], ['disabled', disabled], size])}} {{prefix}}-class-body"
>
Expand All @@ -20,4 +28,4 @@
</view>
</view>
</view>
</view>
</label>