From 4f67cb35475ae06b2cbaf61067c578a9f29eac3f Mon Sep 17 00:00:00 2001 From: gavriel-m Date: Thu, 20 Aug 2026 10:26:11 +0300 Subject: [PATCH 1/2] feat(tour): add navigation.autoFocus to control where step focus lands A tour panel is role="dialog" and focus moves into it when a step opens, so the dialog is announced and Escape is reachable. Until now that focus always landed on the panel element, which means Enter does nothing until the user Tabs to a control - wrong for a read-and-advance tour, and not fixable from outside the library. navigation: { showControls: true, autoFocus: 'primary' } 'panel' - the panel itself (default, unchanged) 'primary' - Next, or Finish on the last step, so Enter advances false - leave focus where it is 'primary' resolves through a data-tip-magic-primary attribute that the content stamps on its own primary action, rather than the tooltip querying for tour classes - the tooltip stays unaware of what a tour is. It falls back to the panel when a step renders no primary action, and never to the close button, where Enter would end the tour. Settable per tour and per step, like the rest of TourNavigation. It lives there rather than at tour level for two reasons: the focus move only happens for steps that render as a dialog, which is exactly when navigation features are present, and TourOptions.focus already means the backdrop - an adjacent autoFocus would be two confusable names for unrelated jobs. Fixes a prerequisite bug found while building it ------------------------------------------------ React re-applies dangerouslySetInnerHTML on every re-render even when the string is byte-identical, rebuilding the whole subtree. Focusing anything inside tour content was therefore unstable: the next re-render - a position update, a visibility change - destroyed the focused node and dropped focus to . Reproduced in isolation, no library code involved. The HTML content span is now memoised on its content string, so the subtree is only rebuilt when the content really changes. Beyond making autoFocus work, this stops the tour panel's markup being re-parsed on every tooltip re-render and stops an or autoplaying