Skip to content

Commit

Permalink
fix(slider): 无障碍滑块valuetext规范.(Tencent#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
byq1213 committed Feb 21, 2023
1 parent ea35275 commit affa6c1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/slider/slider.less
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
transform: translateX(-50%);
top: -52rpx;
text-align: center;
width: 48rpx;
width: 96rpx;
height: 44rpx;
line-height: 44rpx;
}
Expand Down
6 changes: 3 additions & 3 deletions src/slider/slider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ export default class Slider extends SuperComponent {
this.setSingleBarWidth(newValue as number);
}

if(!label){
if (!label) {
this.setData({
isChange: true,
})
});
setTimeout(() => {
this.setData({
isChange: false,
})
});
}, 2e3);
}
},
Expand Down
15 changes: 6 additions & 9 deletions src/slider/slider.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
bind:touchcancel="onTouchEnd"
>
<view
wx:if="{{isChange}}"
id="singleValue"
wx:if="{{label || isChange}}"
class="{{_.cls(classPrefix+'__dot-value', [['sr-only', !label]])}}"
aria-role="alert"
aria-live="assertive"
Expand All @@ -55,7 +54,7 @@
aria-valuemax="{{max}}"
aria-valuemin="{{min}}"
aria-valuenow="{{_value}}"
aria-labelledby="singleValue"
aria-valuetext="{{t.getValue(label, _value) || _value}}"
></view>
</view>
</view>
Expand Down Expand Up @@ -104,8 +103,7 @@
class="{{classPrefix}}__dot {{classPrefix}}__dot--left {{prefix}}-class-cursor"
>
<view
wx:if="{{isChange}}"
id="leftValue"
wx:if="{{label || isChange}}"
class="{{_.cls(classPrefix+'__dot-value', [['sr-only', !label]])}}"
aria-role="alert"
aria-live="assertive"
Expand All @@ -119,7 +117,7 @@
aria-valuemax="{{dotTopValue[1]}}"
aria-valuemin="{{min}}"
aria-valuenow="{{dotTopValue[0]}}"
aria-labelledby="leftValue"
aria-valuetext="{{t.getValue(label, dotTopValue[0]) || dotTopValue[0]}}"
></view>
</view>
<view
Expand All @@ -130,8 +128,7 @@
class="{{classPrefix}}__dot {{classPrefix}}__dot--right {{prefix}}-class-cursor"
>
<view
wx:if="{{isChange}}"
id="rightValue"
wx:if="{{label || isChange}}"
class="{{_.cls(classPrefix+'__dot-value', [['sr-only', !label]])}}"
aria-role="alert"
aria-live="assertive"
Expand All @@ -145,7 +142,7 @@
aria-valuemax="{{max}}"
aria-valuemin="{{dotTopValue[0]}}"
aria-valuenow="{{dotTopValue[1]}}"
aria-labelledby="rightValue"
aria-valuetext="{{t.getValue(label, dotTopValue[1]) || dotTopValue[1]}}"
>
</view>
</view>
Expand Down

0 comments on commit affa6c1

Please sign in to comment.