Handle first click on Zed window - #9553
Conversation
|
@mikayla-maki I refactored the |
|
This came out pretty nice! Let me test drive this a bit tomorrow and see how it feels. |
|
Gave this a test drive, it seems like this has caused a pretty nasty bug where first clicks are treated like a drag event. In this example video, I only click on the terminal-editor border, and I only click on the assets folder, but both cause dragging behavior. BugExample.mov |
|
Oh yikes, I only tested double clicking the files; thanks for the catch! |
|
This works great, thank you! |
|
A good follow up for this PR might be making non-focused hovers work. I noticed that firefox does do a little styling of non-focused tabs you hover over, and I think that would be good behavior for things like the status bar buttons. |
…ies#58562) When handling click events on entries in project panel, we were returning early if the click was the one that brought the Zed window into focus. This effectively ignored the click action on the item. This leads to two clicks being required to act on an item in the project panel if the Zed window is out of focus. The existing behaviour is also inconsistent with other UI controls, where clicking on them when the window is out of focus actually acts upon them. This behaviour was introduced in zed-industries#9553. This PR fixes the click handler on the entries so that events with `first_focus() == true` are no longer ignored. Before: https://github.com/user-attachments/assets/d51ec11d-c47a-4ea3-af6d-63bf6daf3c44 After: https://github.com/user-attachments/assets/87b9e6a8-9ef0-463f-8557-e15d25b519ca Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Closes zed-industries#58261 Release Notes: - Fixed project panel needing a second click to change the file if the window is not in focus
…ies#58562) When handling click events on entries in project panel, we were returning early if the click was the one that brought the Zed window into focus. This effectively ignored the click action on the item. This leads to two clicks being required to act on an item in the project panel if the Zed window is out of focus. The existing behaviour is also inconsistent with other UI controls, where clicking on them when the window is out of focus actually acts upon them. This behaviour was introduced in zed-industries#9553. This PR fixes the click handler on the entries so that events with `first_focus() == true` are no longer ignored. Before: https://github.com/user-attachments/assets/d51ec11d-c47a-4ea3-af6d-63bf6daf3c44 After: https://github.com/user-attachments/assets/87b9e6a8-9ef0-463f-8557-e15d25b519ca Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Closes zed-industries#58261 Release Notes: - Fixed project panel needing a second click to change the file if the window is not in focus
…ies#58562) When handling click events on entries in project panel, we were returning early if the click was the one that brought the Zed window into focus. This effectively ignored the click action on the item. This leads to two clicks being required to act on an item in the project panel if the Zed window is out of focus. The existing behaviour is also inconsistent with other UI controls, where clicking on them when the window is out of focus actually acts upon them. This behaviour was introduced in zed-industries#9553. This PR fixes the click handler on the entries so that events with `first_focus() == true` are no longer ignored. Before: https://github.com/user-attachments/assets/d51ec11d-c47a-4ea3-af6d-63bf6daf3c44 After: https://github.com/user-attachments/assets/87b9e6a8-9ef0-463f-8557-e15d25b519ca Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Closes zed-industries#58261 Release Notes: - Fixed project panel needing a second click to change the file if the window is not in focus
…ies#58562) When handling click events on entries in project panel, we were returning early if the click was the one that brought the Zed window into focus. This effectively ignored the click action on the item. This leads to two clicks being required to act on an item in the project panel if the Zed window is out of focus. The existing behaviour is also inconsistent with other UI controls, where clicking on them when the window is out of focus actually acts upon them. This behaviour was introduced in zed-industries#9553. This PR fixes the click handler on the entries so that events with `first_focus() == true` are no longer ignored. Before: https://github.com/user-attachments/assets/d51ec11d-c47a-4ea3-af6d-63bf6daf3c44 After: https://github.com/user-attachments/assets/87b9e6a8-9ef0-463f-8557-e15d25b519ca Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Closes zed-industries#58261 Release Notes: - Fixed project panel needing a second click to change the file if the window is not in focus
Fixes #4336
Release Notes: