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(Dashboard): Support "Edit chart" click on a new window #28054

Merged
merged 2 commits into from
Apr 16, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
const [openScopingModal, scopingModal] = useCrossFiltersScopingModal(
props.slice.slice_id,
);
const history = useHistory();

const queryMenuRef: RefObject<any> = useRef(null);
const menuRef: RefObject<any> = useRef(null);
Expand Down Expand Up @@ -590,7 +591,12 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
case MenuKeys.ExploreChart:
// eslint-disable-next-line no-unused-expressions
props.logExploreChart?.(props.slice.slice_id);
window.open(props.exploreUrl);
if (domEvent.metaKey || domEvent.ctrlKey) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions here:

  1. Are we sure this works for mac and PC browsers as expected? Seems like it should, but ¯\_(ツ)_/¯
  2. Do we need tests to prevent this regressing again?
  3. Is there a reason we can't just use an HTML link here? I feel like we had that solved at one point.
  4. Is it not amazing that this particular link has been the subject of like 20 PRs and Issues?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Yes it should
  2. Let me see what kind of tests I can add here
  3. We now enable dropdown navigation for accessibility by controlling onClick handlers
  4. Tests should hopefully fix this

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add the unit tests in a follow-up PR to unblock this bug fix

domEvent.preventDefault();
window.open(props.exploreUrl, '_blank');
} else {
history.push(props.exploreUrl);
}
break;
case MenuKeys.ExportCsv:
// eslint-disable-next-line no-unused-expressions
Expand Down Expand Up @@ -907,16 +913,6 @@ const SliceHeaderControls = (props: SliceHeaderControlsPropsWithRouter) => {
placement="bottomRight"
visible={dropdownIsOpen}
onVisibleChange={status => toggleDropdown({ close: !status })}
onBlur={e => {
// close unless the dropdown menu is clicked
const relatedTarget = e.relatedTarget as HTMLElement;
if (
dropdownIsOpen &&
menuRef?.current?.props.id !== relatedTarget?.id
) {
toggleDropdown({ close: true });
}
}}
onKeyDown={e =>
handleDropdownNavigation(
e,
Expand Down
Loading