Skip to content

Handle first click on Zed window - #9553

Merged
mikayla-maki merged 11 commits into
zed-industries:mainfrom
xyzqm:handle-first-click
Mar 25, 2024
Merged

Handle first click on Zed window#9553
mikayla-maki merged 11 commits into
zed-industries:mainfrom
xyzqm:handle-first-click

Conversation

@xyzqm

@xyzqm xyzqm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor

Fixes #4336

Release Notes:

  • Zed now responds to the first, focusing, click on the application window.

@cla-bot cla-bot Bot added the cla-signed The user has signed the Contributor License Agreement label Mar 20, 2024
@xyzqm

xyzqm commented Mar 20, 2024

Copy link
Copy Markdown
Contributor Author

@mikayla-maki I refactored the first_mouse handling into MouseDownEvent, what do you think?

@mikayla-maki

Copy link
Copy Markdown
Member

This came out pretty nice! Let me test drive this a bit tomorrow and see how it feels.

@mikayla-maki mikayla-maki self-assigned this Mar 20, 2024
@mikayla-maki

Copy link
Copy Markdown
Member

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

@xyzqm

xyzqm commented Mar 21, 2024

Copy link
Copy Markdown
Contributor Author

Oh yikes, I only tested double clicking the files; thanks for the catch!

@mikayla-maki
mikayla-maki marked this pull request as draft March 21, 2024 22:26
@xyzqm
xyzqm marked this pull request as ready for review March 21, 2024 22:42
@mikayla-maki

Copy link
Copy Markdown
Member

This works great, thank you!

@mikayla-maki
mikayla-maki merged commit 569a723 into zed-industries:main Mar 25, 2024
@mikayla-maki

Copy link
Copy Markdown
Member

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.

pjlast pushed a commit to pjlast/zed that referenced this pull request Mar 26, 2024
@xyzqm xyzqm mentioned this pull request May 26, 2025
1 task
pull Bot pushed a commit to y1024/zed that referenced this pull request Jun 5, 2026
…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
TomPlanche pushed a commit to TomPlanche/zed that referenced this pull request Jun 8, 2026
…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
jonx pushed a commit to jonx/zed-aros that referenced this pull request Jul 17, 2026
…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
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Focus editor component under cursor instead of last active component

2 participants