fix(ui): open folder items in new tab on CMD/Shift+double-click#16001
Open
amateurbeekeeper wants to merge 1 commit intopayloadcms:mainfrom
Open
fix(ui): open folder items in new tab on CMD/Shift+double-click#16001amateurbeekeeper wants to merge 1 commit intopayloadcms:mainfrom
amateurbeekeeper wants to merge 1 commit intopayloadcms:mainfrom
Conversation
When navigating the folder view, holding CMD or Shift while double-clicking
a file card or table row now opens the target URL in a new browser tab
instead of navigating in the current tab.
Previously, all navigation went through router.push() which always
navigates in-place. The browser's native new-tab behaviour (triggered by
modifier keys on <a> elements) never fired because folder cards and
draggable table rows are div/tr elements with pointer event handlers.
Additionally, CMD/Shift single-click was intercepted for multi-selection
before the double-click detection ran, so modifier-key double-clicks were
impossible to detect. Fix by:
1. Moving double-click detection before the modifier-key branches and
tracking last-clicked item in a dedicated ref (lastClickItemKey)
rather than reusing dragOverlayItem, so modifier-key single-clicks
still count toward the next double-click.
2. Adding a newTab option to navigateAfterSelection that calls
window.open(url, '_blank') instead of router.push().
CMD/Shift single-click still performs multi-select as before.
Fixes payloadcms#15837
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
Fixes #15837
When navigating the folder view, holding CMD or Shift while double-clicking a file card or table row now opens the item in a new browser tab.
Root cause
Two things were broken:
1. No new-tab support in
navigateAfterSelection— navigation always went throughrouter.push(), which navigates in-place. Folder cards and draggable table rows arediv/trelements with pointer event handlers, not<a>tags, so the browser's native new-tab behaviour never fired.2. Modifier-key double-click was undetectable — the double-click check only ran in the
elsebranch (normal click), after theisCtrlPressed/isShiftPressedchecks. So CMD/Shift+double-click was intercepted for multi-selection before double-click detection ever ran. Also, the previous detection useddragOverlayItemas a proxy for "last clicked item", butdragOverlayItemisn't reliably set during modifier-key clicks.Fix
providers/Folders/index.tsxlastClickItemKeyref to reliably track the last-clicked item, independent ofdragOverlayItem.newTab?: booleantonavigateAfterSelection— whentrue, callswindow.open(url, '_blank')instead ofrouter.push().Behaviour
🤖 Generated with Claude Code