Skip to content
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

fix(legend): disable focus and keyboard navigation for legend in partition ch… #952

Merged
merged 3 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 8 additions & 2 deletions src/components/legend/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,19 @@ import React, { MouseEventHandler } from 'react';
interface LabelProps {
label: string;
isSeriesHidden?: boolean;
isToggleable?: boolean;
onClick?: MouseEventHandler;
}
/**
* Label component used to display text in legend item
* @internal
*/
export function Label({ label, onClick, isSeriesHidden }: LabelProps) {
export function Label({ label, isToggleable, onClick, isSeriesHidden }: LabelProps) {
const labelClassNames = classNames('echLegendItem__label', {
'echLegendItem__label--clickable': Boolean(onClick),
});
return (

return isToggleable ? (
<button
type="button"
className={labelClassNames}
Expand All @@ -45,5 +47,9 @@ export function Label({ label, onClick, isSeriesHidden }: LabelProps) {
>
{label}
</button>
) : (
<div className={labelClassNames} title={label} onClick={onClick}>
{label}
</div>
);
}
7 changes: 6 additions & 1 deletion src/components/legend/legend_item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,12 @@ export class LegendListItem extends Component<LegendItemProps, LegendItemState>
hasColorPicker={hasColorPicker}
onClick={this.handleColorClick(hasColorPicker)}
/>
<ItemLabel label={label} onClick={this.handleLabelClick(seriesIdentifier)} isSeriesHidden={isSeriesHidden} />
<ItemLabel
label={label}
isToggleable={item.isToggleable}
onClick={this.handleLabelClick(seriesIdentifier)}
isSeriesHidden={isSeriesHidden}
/>
{showExtra && extra && renderExtra(extra, isSeriesHidden)}
{Action && (
<div className="echLegendItem__action">
Expand Down