Skip to content

Commit

Permalink
Prevent Chrome jumping back to last focused element
Browse files Browse the repository at this point in the history
- when adding field
  • Loading branch information
kertal committed Aug 31, 2020
1 parent 7994764 commit 88b6e76
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export function DiscoverField({
iconType="plusInCircleFilled"
className="dscSidebarItem__action"
onClick={(ev: React.MouseEvent<HTMLButtonElement>) => {
if (ev.type === 'click') {
ev.currentTarget.focus();
}
ev.preventDefault();
ev.stopPropagation();
toggleDisplay(field);
Expand All @@ -155,6 +158,9 @@ export function DiscoverField({
iconType="cross"
className="dscSidebarItem__action"
onClick={(ev: React.MouseEvent<HTMLButtonElement>) => {
if (ev.type === 'click') {
ev.currentTarget.focus();
}
ev.preventDefault();
ev.stopPropagation();
toggleDisplay(field);
Expand Down

0 comments on commit 88b6e76

Please sign in to comment.