Skip to content

CTabFolder: support circular page traversal in MRU mode without chevron#3448

Open
fedejeanne wants to merge 1 commit into
eclipse-platform:masterfrom
fedejeanne:ctabfolder-circular-page-traversal
Open

CTabFolder: support circular page traversal in MRU mode without chevron#3448
fedejeanne wants to merge 1 commit into
eclipse-platform:masterfrom
fedejeanne:ctabfolder-circular-page-traversal

Conversation

@fedejeanne

@fedejeanne fedejeanne commented Jul 17, 2026

Copy link
Copy Markdown
Member

What

Fixes eclipse-platform/eclipse.platform.ui#4135

CTabFolder.onPageTraversal now supports circular keyboard page traversal when setMRUVisible(true) is enabled and all tabs fit without a chevron:

  • Pressing Ctrl+PageDown (SWT.TRAVERSE_PAGE_NEXT) on the last tab now wraps around to the first tab.
  • Pressing Ctrl+PageUp (SWT.TRAVERSE_PAGE_PREVIOUS) on the first tab now wraps around to the last tab.

Previously, in MRU mode with no chevron shown, traversing past the last/first tab had no effect at all (selection stayed put).

This only affects the MRU branch of onPageTraversal. The non-MRU path already wrapped correctly via modulo arithmetic, so its behavior is unchanged. The chevron behavior is intentionally preserved: if there are more tabs than fit and the chevron is shown, traversing past the last/first visible tab still opens the chevron drop-down list exactly as before.

How to test

  1. Run Snippet395 (added in examples/org.eclipse.swt.snippets), which creates a CTabFolder with setMRUVisible(true) and 4 tabs that all fit without a chevron.
  2. Give the CTabFolder focus (click a tab) and select the last tab, then press Ctrl+PageDown: it should now wrap to the first tab.
  3. Select the first tab and press Ctrl+PageUp: it should now wrap to the last tab.
  4. Resize the window (make it narrower) so that the chevron appears (more tabs than fit), and confirm this PR preserves the original behavior: traversing past the last/first visible tab opens the chevron drop-down list instead of wrapping around.

Files changed

  • bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java
  • examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet395.java (new)

When setMRUVisible(true) and all tabs fit without a chevron, navigating
past the last tab with Ctrl+PageDown (TRAVERSE_PAGE_NEXT) or before the
first tab with Ctrl+PageUp (TRAVERSE_PAGE_PREVIOUS) had no effect. Now
navigation wraps around to the first/last visible tab respectively,
matching the existing behavior of the non-MRU traversal path.

Adds Snippet395 demonstrating the before/after behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
fedejeanne added a commit to fedejeanne/eclipse.platform.ui that referenced this pull request Jul 17, 2026
Restores the standard focus-traversal behavior in TraversePageHandler by
removing the special-casing that was added for CTabFolder
(loop-to-first/
last-item logic, hidden-item detection, and the top-level CTabFolder
lookup helpers introduced by eclipse-platform#2864 and the earlier fix for eclipse-platform#4135).

This special-casing was a workaround for CTabFolder not looping over its
own tabs when using Ctrl+PageUp/PageDown. That is now fixed directly in
SWT's CTabFolder.onPageTraversal (see
eclipse-platform/eclipse.platform.swt#3448), which makes this handler's
workaround unnecessary and, in some cases, incorrect (e.g. it bypassed
the chevron/drop-down list when tabs did not fit).

Requires eclipse-platform/eclipse.platform.swt#3448 to be
merged/available
for the circular navigation behavior to still work correctly.

Fixes eclipse-platform#4135

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

  200 files  ±0    200 suites  ±0   29m 2s ⏱️ -49s
4 744 tests ±0  4 720 ✅ ±0   24 💤 ±0  0 ❌ ±0 
6 892 runs  ±0  6 724 ✅ ±0  168 💤 ±0  0 ❌ ±0 

Results for commit a335951. ± Comparison against base commit 1603edd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

'Tab' navigatin Bug. Ctrl+PageUp -> Next Tab, Ctrl+PageDown -> Previous Tab.

1 participant