Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 无障碍访问api
Browse files Browse the repository at this point in the history
* feat: 支持无障碍访问api

* fix: 支付宝小程序支持无障碍访问api

Co-authored-by: mushan <[email protected]>
  • Loading branch information
yesmeck and mushan0x0 authored Sep 6, 2021
1 parent 6590642 commit 35a1af6
Show file tree
Hide file tree
Showing 84 changed files with 3,736 additions and 38 deletions.
2 changes: 1 addition & 1 deletion packages/remax-ali/src/__tests__/components/View.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('View', () => {
const callback = () => void 0;

const testRenderer = TestRenderer.create(
<View onAnimationStart={callback} catchClick={callback} className="class">
<View ariaLabel="view" onAnimationStart={callback} catchClick={callback} className="class">
view
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

exports[`View render correctly 1`] = `
<view
ariaLabel="view"
catchClick={[Function]}
className="class"
onAnimationStart={[Function]}
Expand Down
30 changes: 29 additions & 1 deletion packages/remax-ali/src/hostComponents/View/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
import * as React from 'react';
import { createHostComponent } from '@remax/runtime';

export interface ViewProps {
/** 无障碍属性 */
// reference: https://opendocs.alipay.com/mini/component/accessibility
export interface AriaProps {
ariaHidden?: string;
ariaRole?: string;
ariaLabel?: string;
ariaChecked?: string;
ariaDisabled?: string;
ariaDescribedby?: string;
ariaExpanded?: string;
ariaHaspopup?: string;
ariaSelected?: string;
ariaRequired?: string;
ariaOrientation?: string;
ariaValuemin?: string;
ariaValuemax?: string;
ariaValuenow?: string;
ariaReadonly?: string;
ariaMultiselectable?: string;
ariaControls?: string;
tabindex?: string;
ariaLabelledby?: string;
ariaModal?: string;
ariaLive?: string;
ariaAtomic?: string;
ariaRelevant?: string;
}

export interface ViewProps extends AriaProps {
readonly dataset?: DOMStringMap;
id?: string;
className?: string;
Expand Down
24 changes: 24 additions & 0 deletions packages/remax-ali/src/hostComponents/View/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,30 @@ export const alias = {
onAppear: 'onAppear',
onDisappear: 'onDisappear',
onFirstAppear: 'onFirstAppear',
/** 无障碍属性 */
ariaHidden: 'aria-hidden',
ariaRole: 'aria-role',
ariaLabel: 'aria-label',
ariaChecked: 'aria-checked',
ariaDisabled: 'aria-disabled',
ariaDescribedby: 'aria-describedby',
ariaExpanded: 'aria-expanded',
ariaHaspopup: 'aria-haspopup',
ariaSelected: 'aria-selected',
ariaRequired: 'aria-required',
ariaOrientation: 'aria-orientation',
ariaValuemin: 'aria-valuemin',
ariaValuemax: 'aria-valuemax',
ariaValuenow: 'aria-valuenow',
ariaReadonly: 'aria-readonly',
ariaMultiselectable: 'aria-multiselectable',
ariaControls: 'aria-controls',
tabindex: 'tabindex',
ariaLabelledby: 'aria-labelledby',
ariaModal: 'aria-modal',
ariaLive: 'aria-live',
ariaAtomic: 'aria-atomic',
ariaRelevant: 'aria-relevant',
};

export const props = unique(Object.values(alias));

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 35a1af6

Please sign in to comment.