Scroll the app health banner button to the connections section
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.
What changed
- A tab hash can now carry a section:
#general/connections. Every hash reader goes throughparseTabRouteHash, so the tab bar, the tab content and the legacy tab redirects keep agreeing. The section id lives intwenty-shared/applicationnext to the tab ids. SettingsSectionAnchorwraps the connections section and tags it with adata-settings-section-id. When the hash targets it,SettingsSectionAnchorScrollEffectfinds the node by that attribute and callswatchSettingsSectionAnchorScroll, which scrolls it into view; the anchor fades anaccent.tertiarytint 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.
watchSettingsSectionAnchorScrollkeeps following page size changes until the user scrolls or presses a key, then re-scrolls. It follows thewatchCallRecordingTranscriptFollowScrollshape: a pure util with its own unit test, driven by an Effect component, so nouseEffectoruseReflives in a hook or a rendering component. SettingsApplicationConnectionsSectionfilters 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
actiondocuments 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;
watchSettingsSectionAnchorScrollandparseTabRouteHashhave unit tests; Slack and Teams health check unit tests updated and passing. - Storybook:
SettingsSectionAnchorhas Targeted and NotTargeted stories asserting the highlight attribute. lint:diff-with-mainandtsgo --noEmitare 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.