From 1b20159b301bff469769a7dfe336a8d910b8f772 Mon Sep 17 00:00:00 2001 From: kat-chen-tm <70346175+kat-chen-tm@users.noreply.github.com> Date: Mon, 21 Mar 2022 16:50:54 -0700 Subject: [PATCH] perf(Modal): CO-6277: add accessibility attributes (#722) --- .npmrc | 2 +- .nvmrc | 1 + .travis.yml | 3 -- README.md | 2 - catalog/pages/adaptive_modal/index.md | 6 +++ catalog/pages/buttons/index.md | 4 ++ .../__snapshots__/index.spec.js.snap | 18 ++++----- src/components/Button/Base.tsx | 9 +++-- .../__snapshots__/index.spec.js.snap | 16 ++++++++ src/components/Modal/index.js | 40 ++++++++++++++++--- 10 files changed, 78 insertions(+), 23 deletions(-) create mode 100644 .nvmrc diff --git a/.npmrc b/.npmrc index a57cc9e54..214c29d13 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -registry=http://registry.npmjs.org/ +registry=https://registry.npmjs.org/ diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..6276cf12f --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16.14.2 diff --git a/.travis.yml b/.travis.yml index 461737b96..73f74ac13 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ cache: - node_modules notifications: email: false -node_js: - - '12' script: - npm run lint - npm run lint:css @@ -31,4 +29,3 @@ deploy: branches: only: - master - - /^greenkeeper/.*$/ diff --git a/README.md b/README.md index 9bc8ad2c5..69a2d2004 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,6 @@ [![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] -[![Greenkeeper badge][greenkeeper-badge]](https://greenkeeper.io/) [![version][version-badge]][package] [![MIT License][license-badge]][license] @@ -74,7 +73,6 @@ MIT [build]: https://travis-ci.org/ticketmaster/aurora [coverage-badge]: https://img.shields.io/codecov/c/github/ticketmaster/aurora.svg [coverage]: https://codecov.io/github/ticketmaster/aurora -[greenkeeper-badge]: https://badges.greenkeeper.io/ticketmaster/aurora.svg [version-badge]: https://img.shields.io/npm/v/@ticketmaster/aurora.svg [package]: https://www.npmjs.com/package/@ticketmaster/aurora [license-badge]: https://img.shields.io/npm/l/@ticketmaster/aurora.svg diff --git a/catalog/pages/adaptive_modal/index.md b/catalog/pages/adaptive_modal/index.md index de9ae1867..4adba1226 100644 --- a/catalog/pages/adaptive_modal/index.md +++ b/catalog/pages/adaptive_modal/index.md @@ -48,6 +48,12 @@ rows: - Prop: onScroll Type: func(Event) Notes: Optional. Callback is fired when the user scrolls modal's content + - Prop: focusElement + Type: React ref + Notes: Optional. Focuses on referenced element when modal is opened. + - Prop: modalId + Type: string + Notes: Optional. Sets ids of modal's title and content elements as modalId followed by '-title' and '-content' respectively. ``` ```react diff --git a/catalog/pages/buttons/index.md b/catalog/pages/buttons/index.md index d50ff5980..804416a78 100644 --- a/catalog/pages/buttons/index.md +++ b/catalog/pages/buttons/index.md @@ -30,6 +30,10 @@ rows: Type: any Default: Notes: Passes through any other props to underlying button, or in the case of an href prop being passed, anchor, element + - Prop: forwardedRef + Type: any + Default: null + Notes: React ref forwarded to button element. ``` ### Standard button diff --git a/src/components/Banner/__tests__/__snapshots__/index.spec.js.snap b/src/components/Banner/__tests__/__snapshots__/index.spec.js.snap index fa8f5f544..f187b3567 100644 --- a/src/components/Banner/__tests__/__snapshots__/index.spec.js.snap +++ b/src/components/Banner/__tests__/__snapshots__/index.spec.js.snap @@ -107,7 +107,7 @@ exports[` renders correctly when open 1`] = ` This is your primary message text.
renders correctly when variant is set 1`] = ` This is your primary message text.
renders correctly with close button 1`] = ` This is your primary message text.
renders correctly with close button hidden 1`] = ` This is your primary message text.
renders correctly with content 1`] = ` This is your primary message text.
renders correctly with custom icon 1`] = ` This is your primary message text.
renders correctly with custom title for the close button 1`] test link text
renders correctly with expand/collapse button 1`] = ` collapsedText
renders correctly with link 1`] = ` test link text
{ variant: PropTypes.oneOf(BUTTON_VARIANTS), size: PropTypes.oneOf(SIZES), icon: PropTypes.node, - children: PropTypes.node.isRequired + children: PropTypes.node.isRequired, + forwardedRef: PropTypes.objectOf(PropTypes.any) }; static defaultProps: ButtonProps = { size: REGULAR, variant: STANDARD, - icon: null + icon: null, + forwardedRef: null }; componentDidMount() { @@ -78,7 +81,7 @@ class Button extends Component { } }; - button = React.createRef(); + button = this.props.forwardedRef || React.createRef(); render() { const { variant, size, icon, children, ...rest } = this.props; diff --git a/src/components/Modal/__tests__/__snapshots__/index.spec.js.snap b/src/components/Modal/__tests__/__snapshots__/index.spec.js.snap index 236f6a3f2..4f779ed75 100644 --- a/src/components/Modal/__tests__/__snapshots__/index.spec.js.snap +++ b/src/components/Modal/__tests__/__snapshots__/index.spec.js.snap @@ -182,7 +182,9 @@ exports[` closeModal should close the modal when the request was approv class="c0 container--overlay" >