-
Notifications
You must be signed in to change notification settings - Fork 118
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
feat(a11y): add label for screen readers #1121
Changes from 1 commit
1087852
4cb8ddc
e1c4fcd
e20033a
2612a2a
a88737d
19fb650
d9f34a7
532bd0d
356b754
e770e99
c1a9b8d
6150d2d
b81e6f8
d757d9e
deff638
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { A11ySettings } from '../../state/selectors/get_accessibility_config'; | ||
|
||
/** @internal */ | ||
export function Description(props: A11ySettings) { | ||
if (!props.description) return null; | ||
return <p id={props.descriptionId}>{props.description}</p>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import { A11ySettings } from '../../state/selectors/get_accessibility_config'; | ||
|
||
/** @internal */ | ||
export function Label(props: A11ySettings) { | ||
if (!props.label) return null; | ||
const Heading = props.labelHeadingLevel; | ||
return <Heading id={props.labelId}>{props.label}</Heading>; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,8 +155,7 @@ export const DEFAULT_SETTINGS_SPEC: SettingsSpec = { | |
baseTheme: LIGHT_THEME, | ||
brushAxis: BrushAxis.X, | ||
minBrushDelta: 2, | ||
useDefaultSummary: true, | ||
headingLevel: 'p', | ||
|
||
ariaUseDefaultSummary: true, | ||
ariaLabelHeadingLevel: 'h2', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. committing in #1118 thank you! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks sorry about that, I was reading the API docs and was marked as h2 |
||
...DEFAULT_LEGEND_CONFIG, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markov00 Setting the summary
id
here would be ideal butaria-labelledby
can't reliably report structured content so we're better off putting it on a simple string. Reporting just the chart type seems appropriate for a supplemental description (better than nothing, type of situation).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
committing in #1118