From 458c534200cc65aab200ff77e987aec9c1a3e1a8 Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Mon, 20 Mar 2017 14:46:09 -0700 Subject: [PATCH] [change] improve button accessibility and styling 1. If no 'accessibilityRole' is set, fallback to looking for 'button' role in the equivalent native props. This helps improve accessibility of button-like components authored without the web platform in mind. 2. Ensure button context is properly inherited. 3. Add 'appearance:none' to DOM button elements to enable better styling support in Safari Fix #378 --- .../renderApplication-test.js.snap | 1 + .../__snapshots__/index-test.js.snap | 3 +- src/components/View/index.js | 21 ++++++++---- .../__snapshots__/index-test.js.snap | 22 +++++++++++++ .../createDOMElement/__tests__/index-test.js | 29 +++++++++++++++++ src/modules/createDOMElement/index.js | 32 +++++++++++-------- .../__tests__/index-test.js | 28 ++++++++++++++++ src/modules/getAccessibilityRole/index.js | 15 +++++++++ 8 files changed, 131 insertions(+), 20 deletions(-) create mode 100644 src/modules/getAccessibilityRole/__tests__/index-test.js create mode 100644 src/modules/getAccessibilityRole/index.js diff --git a/src/apis/AppRegistry/__tests__/__snapshots__/renderApplication-test.js.snap b/src/apis/AppRegistry/__tests__/__snapshots__/renderApplication-test.js.snap index 5ab83d9e..649ffddf 100644 --- a/src/apis/AppRegistry/__tests__/__snapshots__/renderApplication-test.js.snap +++ b/src/apis/AppRegistry/__tests__/__snapshots__/renderApplication-test.js.snap @@ -50,5 +50,6 @@ input::-webkit-inner-spin-button,input::-webkit-outer-spin-button,input::-webkit .rn-paddingLeft-gy4na3{padding-left:0px} .rn-textAlign-1ttztb7{text-align:inherit} .rn-textDecoration-bauka4{text-decoration:none} +.rn-appearance-30o5oe{-moz-appearance:none;-webkit-appearance:none;appearance:none} " `; diff --git a/src/components/View/__tests__/__snapshots__/index-test.js.snap b/src/components/View/__tests__/__snapshots__/index-test.js.snap index 11e5f418..a306af59 100644 --- a/src/components/View/__tests__/__snapshots__/index-test.js.snap +++ b/src/components/View/__tests__/__snapshots__/index-test.js.snap @@ -20,8 +20,9 @@ exports[`components/View rendered element is a "div" by default 1`] = ` exports[`components/View rendered element is a "span" when inside 1`] = `