Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Delay pane activation on mousedown to fix loss of focus - #150

Merged
nathansobo merged 1 commit into
masterfrom
ns-fix-focus-on-click
Jun 10, 2015
Merged

nathansobo merged 1 commit into
masterfrom
ns-fix-focus-on-click

Conversation

@nathansobo

Copy link
Copy Markdown
Contributor

Force pushed an update to this pull request. This should now fix atom/atom#6662 without breaking dragging.

There's a complex interaction going on between focus, mousedown, and dragstart events. It seems that no matter what I try, if document.activeElement changes synchronously during a mousedown event, the subsequent dragstart event is never handled. There may be a hidden issue regarding our focus handling in core that would enable a more elegant fix to this, but I haven't been able to find it and would like to just fix the immediate issue for now.

@izuzak

izuzak commented May 29, 2015

Copy link
Copy Markdown
Contributor

@nathansobo This seems to break the ability to drag tabs (e.g. to reorder them in the tab bar, or to drag them to another window). Are you seeing the same problem with these changes applied?

@nathansobo nathansobo changed the title Remove tabindex from tab bar to fix loss of focus on mousedown Delay pane activation on mousedown to fix loss of focus Jun 10, 2015
@nathansobo

Copy link
Copy Markdown
Contributor Author

@izuzak Want to give this a spin?

@izuzak

izuzak commented Jun 10, 2015

Copy link
Copy Markdown
Contributor

@nathansobo Works great, as far as I can tell! ⚡

nathansobo pushed a commit that referenced this pull request Jun 10, 2015
Delay pane activation on mousedown to fix loss of focus
@nathansobo
nathansobo merged commit 513b736 into master Jun 10, 2015
@nathansobo
nathansobo deleted the ns-fix-focus-on-click branch June 10, 2015 21:00
matthewwithanm added a commit that referenced this pull request May 12, 2017
This was originally added way back in 310c058 however, a tabindex of -1
means that the tab bar can receive focus.

As a result, focus would end up being transferred to the tab bar as
part of the default action of the mousedown handler. When the `Pane` is
activated, it would see that its child (the tab bar) had focus and
leave it there, meaning the tab bar (instead of the editor) would
retain focus. This behavior was first reported in #14173, however the
original fix for it (#14175) resulted in Panes always stealing the
focus from their children. This regression was rectified with
atom/atom#14403 and #439, but really the tab bar shouldn't be
focusable in the first place. Making this adjustment means we no longer
have to delay the activation of the item and pane (#150 and
atom/tabs#tabs#439) since the focus will no longer be given to the tab
bar as part of the default action of the mousedown handler.
matthewwithanm added a commit that referenced this pull request May 15, 2017
This was originally added way back in 310c058 however, a tabindex of -1
means that the tab bar can receive focus.

As a result, focus would end up being transferred to the tab bar as
part of the default action of the mousedown handler. When the `Pane` is
activated, it would see that its child (the tab bar) had focus and
leave it there, meaning the tab bar (instead of the editor) would
retain focus. This behavior was first reported in #14173, however the
original fix for it (#14175) resulted in Panes always stealing the
focus from their children. This regression was rectified with
atom/atom#14403 and #439, but really the tab bar shouldn't be
focusable in the first place. Making this adjustment means we no longer
have to delay the activation of the item and pane (#150 and
atom/tabs#tabs#439) since the focus will no longer be given to the tab
bar as part of the default action of the mousedown handler.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cursor position forgotten between tabs

2 participants