fixing accessibility for time filter button (#43891)
* fixing accessibility for time filter button * updating storyshots * fixing string concatenation
This commit is contained in:
parent
d859b79a98
commit
b49192626a
|
@ -15,6 +15,7 @@ exports[`Storyshots renderers/TimeFilter compact mode 1`] = `
|
|||
className="euiPopover__anchor canvasTimePickerPopover__anchor"
|
||||
>
|
||||
<button
|
||||
aria-label="Displaying data Last 7 days. Click to open a calendar tool to select a new time range."
|
||||
className="canvasTimePickerPopover__button"
|
||||
onClick={[Function]}
|
||||
>
|
||||
|
|
|
@ -15,6 +15,7 @@ exports[`Storyshots renderers/TimeFilter/components/TimePickerPopover default 1`
|
|||
className="euiPopover__anchor canvasTimePickerPopover__anchor"
|
||||
>
|
||||
<button
|
||||
aria-label="Displaying data ~ a month ago to ~ in 3 days. Click to open a calendar tool to select a new time range."
|
||||
className="canvasTimePickerPopover__button"
|
||||
onClick={[Function]}
|
||||
>
|
||||
|
|
|
@ -9,6 +9,7 @@ import PropTypes from 'prop-types';
|
|||
// @ts-ignore untyped local
|
||||
import { Popover } from '../../../../../public/components/popover';
|
||||
import { PrettyDuration } from '../pretty_duration';
|
||||
import { formatDuration } from '../pretty_duration/lib/format_duration';
|
||||
import { TimePicker } from '../time_picker';
|
||||
|
||||
export interface Props {
|
||||
|
@ -22,7 +23,14 @@ export interface Props {
|
|||
|
||||
export const TimePickerPopover: FunctionComponent<Props> = ({ from, to, onSelect }) => {
|
||||
const button = (handleClick: (event: MouseEvent<HTMLButtonElement>) => void) => (
|
||||
<button className="canvasTimePickerPopover__button" onClick={handleClick}>
|
||||
<button
|
||||
className="canvasTimePickerPopover__button"
|
||||
aria-label={`Displaying data ${formatDuration(
|
||||
from,
|
||||
to
|
||||
)}. Click to open a calendar tool to select a new time range.`}
|
||||
onClick={handleClick}
|
||||
>
|
||||
<PrettyDuration from={from} to={to} />
|
||||
</button>
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue