Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Blob UI: Disable return to target logic in blame popover UI #43353

Merged
merged 1 commit into from
Oct 24, 2022

Conversation

vovakulikov
Copy link
Contributor

@vovakulikov vovakulikov commented Oct 24, 2022

Fixes https://github.com/sourcegraph/sourcegraph/issues/43335

Background

Previously before we merged https://github.com/sourcegraph/sourcegraph/pull/43029 the PopoverContent didn't do anything with focus (didn't return it to the original target) if focusLocked is specified and set to false. In https://github.com/sourcegraph/sourcegraph/pull/43029 I changed this behaviour, and now PopoverContent exposes the returnTargetFocus prop to turn on/off focus preservation after Popover has been closed.

The recursion (why we have problem in Blame annotations) is

  • Blame line (let's call it target 1) is listening to focus and showing a tooltip on the focused target (let's call this Popover1)
  • If you move the cursor (hover over another blame line, let's say target 2) or you're going through blame lines with a keyboard you focus next target (target 2), and the previous target (target 1) emits a blur which closes the Popover 1
  • Since returnTargetFocus by default is true the Popover 1 returns popover to the target 1
  • And this is a loop, you're hovering over target 2, and we close popover 1, which closes returns focus to target 1, and we open Popover 1

I shared my feedback about this that this blame popover should use a tooltip pattern and doesn't have any interactive element as content. And in this case, we wouldn't be needed in any focus popover-like management in this UI.

Test plan

  • Open blob UI
  • Try to open and hover/focus blame line annotation
  • Commit message/info popover should work properly and without any freezes when you're navigating through blame line annotations

App preview:

Check out the client app preview documentation to learn more.

@sg-e2e-regression-test-bob

Bundle size report 📦

Initial size Total size Async size Modules
0.00% (0.00 kb) 0.00% (+0.04 kb) 0.00% (+0.04 kb) 0.00% (0)

Look at the Statoscope report for a full comparison between the commits 3c29d00 and a00f9e9 or learn more.

Open explanation
  • Initial size is the size of the initial bundle (the one that is loaded when you open the page)
  • Total size is the size of the initial bundle + all the async loaded chunks
  • Async size is the size of all the async loaded chunks
  • Modules is the number of modules in the initial bundle

Copy link
Contributor

@philipp-spiess philipp-spiess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep yep

@philipp-spiess philipp-spiess enabled auto-merge (squash) October 24, 2022 13:29
@philipp-spiess philipp-spiess merged commit 62fe752 into main Oct 24, 2022
@philipp-spiess philipp-spiess deleted the vk/fix-blame-popover branch October 24, 2022 13:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

UI error
3 participants