-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Improve dock tabs UX #4754
Improve dock tabs UX #4754
Conversation
665f37a
to
994ae50
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
e12bf67
to
70c3d03
Compare
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: DmitriyNoa <dmytro.zharkov@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -20,6 +22,14 @@ export interface DockTabsProps { | |||
} | |||
|
|||
export const DockTabs = ({ tabs, autoFocus, selectedTab, onChangeTab }: DockTabsProps) => { | |||
const elem = useRef<HTMLDivElement>(); | |||
const minTabSize = useRef<number>(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this a ref and not state
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating it only once and basically using it as instance variable - keeping across rerenders. https://reactjs.org/docs/hooks-faq.html#is-there-something-like-instance-variables
I'm seeing some odd behaviour, sometimes when I click on a tab (one in the middle, not clipped) the tabs shift but the tab I clicked on is not selected. Screen.Recording.2022-03-16.at.11.32.27.AM.movSeems to only happen the first time you try to select a tab this way. I had to restart the app to reproduce. |
Seems to open (and scroll if necessary) to the last tab when you close a tab: Screen.Recording.2022-03-16.at.11.44.22.AM.movBetter to open a neighbouring tab? |
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
@Nokel81 @jim-docker Fixed all addressed issues except one described below. Please review again. dock.tabs.in.action.mov |
Related this one
I don't think it's a good decision since this will lead us to layout jumps since switching active tab will cause all sibling tabs to change their sizes instantly. Also, can't find similar behavior across other apps. |
Okay I just know that in vscode the default tab size is such that for most file names it doesn't happen. |
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jim-docker Created an issue with the bug you found. Happens in |
Closes: #4459
The current solution is inspired by VSCode and Webstrom tabs management solutions.
When the number of tabs is getting too high the area will be scrollable.
When the number of tabs is getting too high the scroll control are presented (scroll left, and scroll right).
Scroll controls are displayed based on the scroll position.
Tabs are now clearly separated from each other.
The active tab is highlighted and visible.
The double click handler was removed as it sometimes caused accidental close of the terminal area.
The active tab can be changed with keypress:
Next tab ctrl + .
Previous tab ctrl + ,
Some comments:
I decided to avoid the shrinking of the tabs as they are added because it makes navigation and searches pretty difficult (titles are getting cropped and the size is too small). Looks like it's common to approach among IDEs to scroll tabs.
VSCode approach with scroll:
Webstrom approach with arrows:
E.g. browser scenario with too many tabs:
Additional suggestions to add:
Drag and drop to change the order of the tabs?
UPDATE
Latest UX changes can be viewed below -> #4754 (comment)