Skip to content

Block mouse interaction while breadcrumbs/selectboxcustom dropdown is visible #113723

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jeanp413
Copy link
Contributor

@jeanp413 jeanp413 commented Jan 3, 2021

Used the same approach as in contextMenuHandler to block mouse events

This PR fixes #113675

@jrieken
Copy link
Member

jrieken commented Jan 4, 2021

Hm.... not a big fan. Breadcrumb pickers should close when resizing parts in the workbench IMO

@jeanp413
Copy link
Contributor Author

jeanp413 commented Jan 5, 2021

Is there a way to detect that something is being resized so I can hide the breadcrumb picker?

Another option would be something like this (which doesn't look nice either)

const mouseDownListener = dom.addDisposableListener(window, dom.EventType.MOUSE_DOWN, e => {
	// // #113675 This mouse event is outside the breadcrumb so it counts as a focus out
	if (!dom.isAncestor(e.target as HTMLElement, this._widget.domNode) && !dom.isAncestor(e.target as HTMLElement, parent)) {
		this._contextViewService.hideContextView(this);
	}
});

Another one is removing this line that just calls e.preventDefault() underneath in the sash mousedown event handler. Doing so will transfer focus to the body and trigger the focusTracker onDidBlur event. Not sure if something else is relaying on this current behavior but it looks safe

EventHelper.stop(e, false);

@jrieken
Copy link
Member

jrieken commented Jan 5, 2021

Is there a way to detect that something is being resized so I can hide the breadcrumb picker?

That's the question. @sbatten should know

@sbatten
Copy link
Member

sbatten commented Jan 7, 2021

It's not exactly what you want but its the only existing option I can think of, but if you can listen to the IWorkbenchLayoutService.onLayout event, once a resize happens, you could dismiss the dropdown.

However, I prefer the functionality of your initial PR more because:

  • We got the behavior from macOS for the context menus and it proves to be quite nice
  • Looking to Xcode's breadcrumbs shows that macOS also uses this technique so this would be consistent

@jeanp413
Copy link
Contributor Author

jeanp413 commented Jan 8, 2021

@jrieken what do you think, should I still give it a try with IWorkbenchLayoutService.onLayout? or is the current implementation good enough as sbatten pointed out

@sbatten
Copy link
Member

sbatten commented Jan 11, 2021

@jeanp413 should this behavior be on the custom select box? e.g. the terminal selector box suffers the same behavior

@jeanp413
Copy link
Contributor Author

@sbatten yes, you can see it in the second gif I uploaded in the linked issue #113675

@sbatten
Copy link
Member

sbatten commented Jan 11, 2021

@jeanp413 ah I see, I missed in the PR that the breadcrumbs control was doing something special so you have to handle it in both places.

@vivodi
Copy link

vivodi commented Dec 29, 2024

Is this still relevant?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breadcrumbs/selectbox dropdown does not relayout after resizing panel
4 participants