Scroll the app health banner button to the connections section

Merged
AB
6h ago
+435-26

Context

The Slack and Teams health checks render a banner with a "Manage connection" / "Add connection" button whose location is #general. The front turns that into a router navigate to the hash. The connections section is the last section of the General tab, and General is the default tab, so:

  • on the General tab the click changes nothing visible, the button looks dead;
  • from another tab it switches to General but leaves the connections section below the fold.

Demo

Teams app page with a mocked failing health check. First click from the General tab: the page scrolls to the connections section and highlights it. Then from the Settings tab: the click switches to General and lands on the section.

Health banner button scrolling to the connections section

What changed

  • A tab hash can now carry a section: #general/connections. Every hash reader goes through parseTabRouteHash, so the tab bar, the tab content and the legacy tab redirects keep agreeing. The section id lives in twenty-shared/application next to the tab ids.
  • SettingsSectionAnchor wraps the connections section and tags it with a data-settings-section-id. When the hash targets it, SettingsSectionAnchorScrollEffect finds the node by that attribute and calls watchSettingsSectionAnchorScroll, which scrolls it into view; the anchor fades an accent.tertiary tint over it. Each router navigation gets a new location key, so clicking the banner again replays it. Reduced motion turns off both the smooth scroll and the fade.
  • On a full page load the anchor mounts while the Content section above is still loading and gets pushed back out of view ~20ms later. watchSettingsSectionAnchorScroll keeps following page size changes until the user scrolls or presses a key, then re-scrolls. It follows the watchCallRecordingTranscriptFollowScroll shape: a pure util with its own unit test, driven by an Effect component, so no useEffect or useRef lives in a hook or a rendering component.
  • SettingsApplicationConnectionsSection filters workspace providers up front so the anchor never renders empty.
  • Slack and Teams point their banner actions at #general/connections. The two Teams "Add connection" labels become "Open connections", since the button opens the section rather than adding anything. Versions bumped to 1.10.2 and 1.1.1.
  • The SDK docs row for action documents the new hash form.

Trade-off

An older front does not understand the new hash and falls back to the active tab, which is today's behaviour. A typed action (start OAuth, open the broken connection) would be a cleaner product fix but needs a new SDK shape, a release and an app bump before either app could use it, so this keeps the fix front-only.

Verification

  • Jest: settings components, tab list and application pages suites pass; watchSettingsSectionAnchorScroll and parseTabRouteHash have unit tests; Slack and Teams health check unit tests updated and passing.
  • Storybook: SettingsSectionAnchor has Targeted and NotTargeted stories asserting the highlight attribute.
  • lint:diff-with-main and tsgo --noEmit are clean.
  • Checked in the dev app on the Teams page: the deep link scrolls to the connections section in light and dark mode, and switching from the Settings tab to the hash lands on General with the section in view.