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

feat(svelte): Improve small screeen behavior#63859

Merged
fkling merged 4 commits into
mainfrom
fkling-srch-730-low-lift-mobile-support
Jul 17, 2024
Merged

feat(svelte): Improve small screeen behavior#63859
fkling merged 4 commits into
mainfrom
fkling-srch-730-low-lift-mobile-support

Conversation

@fkling

@fkling fkling commented Jul 16, 2024

Copy link
Copy Markdown
Contributor

Closes srch-730

This is an initial attempt to improve the web app for small screens. This commit makes the following changes for small screens:

  • Search home page:
    • No more search input overflow
    • History button is rendered on same line as other action buttons (saves some vertical space)
  • Search results page:
    • Search input is rendered in the page, not in the header (more space)
    • Filters sidebar is hidden by default and can be shown via a Filters button.
    • The filters sidebar opens fullscreen and has a close button
    • The progrss button is smaller due to showing less information
  • Repository pages:
    • File sidebar is hidden by default. It can be shown via a new button that is visible in the file headers
    • The file sidebar opens fullscreen and has a close button
    • NOTE: Selecting a file currently does not close the file sidebar, navigation happens in the background
    • Cody sidebar opens fullscreen and has the same close button
  • General:
    • Fuzzy finder opens fullscreen and has a larger close button
    • Tabs don't show keyboard shortcuts

I tried to stick to CSS as much as possible but for some things to work I had to change component structures or rendered elements conditionally. Specifically when a component was already using $isViewportMobile I usually just rendered elements conditionally.

I extended the Panel component to have a special 'mobile' mode, since I realized I was doing similar changes to the filters, file tree and cody sidebar.
The cody sidebar is a bit of a special case though because it's not even rendered by default. So there are some additional steps required to sync the open state.

Screenshots (iPhone SE, which is one of the smaller phones I guess)

Situation Before After
Search home 2024-07-16_19-13 2024-07-16_19-16_2
Search results 2024-07-16_19-14 2024-07-16_19-17
Filters 2024-07-16_19-14 2024-07-16_19-17_1
Repo 2024-07-16_19-15_1 2024-07-16_19-17_3
File sidebar 2024-07-16_19-15_1 2024-07-16_19-17_4
Cody sidebar 2024-07-16_19-15_2 2024-07-16_19-18
Repo search 2024-07-16_19-16_1 2024-07-16_19-17_5
Fuzzy finder 2024-07-16_19-16 2024-07-16_19-18_1
Rev picker 2024-07-17_00-42 2024-07-17_00-41

Me rambling about the changes:

sg-sk-mobile.mp4

Note that the commits and commit pages already seem to look fine. The branches, tags and contributors pages are a bit broken due to use of tables and fixed columns. I can look at those separately.

Test plan

Manual testing

@fkling fkling self-assigned this Jul 16, 2024
@cla-bot cla-bot Bot added the cla-signed label Jul 16, 2024
@fkling fkling force-pushed the fkling-srch-730-low-lift-mobile-support branch from 86a488d to c59b8b2 Compare July 16, 2024 19:41

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I guess this won't happen on actual mobile devices but in the simulator the popovers caused some strange page shift as the library tries to fit them into the view. I thought it makes sense to disable them for now for small devices.

Comment thread client/web-sveltekit/src/lib/dom.ts Outdated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Search input suggestions didn't properly resize to the available space as they were loaded asynchronously. Maybe there's a way that doesn't rely on mutation observer but it seems to work for now, and was a relatively small change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without this the sidebar didn't shrink to the available screen size.

Comment on lines 112 to 121

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure if that is a good idea or not, but I also didn't want to add multiple properties just to influence styling. This seemed like a good compromise.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Every time when someone uses a bitmask something good wakes up in my soul, thanks

Comment on lines 503 to 517

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was just moved from above as is.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't know how I triggered this but I got an error that unsubscribe was accessed before it was assigned.
subscribe will call the callback synchronously so it's possible that the store already has a value that matches the conditions and unsubscribe is called before subscribe returned.
Moving this around fixes this issue.

Comment thread client/web-sveltekit/src/lib/dom.ts Outdated
Comment on lines 165 to 176

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added this to resize popovers vertically.

Comment on lines 134 to 136

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Instead of having Popover hide on click when showOnHover is on, we do it manually here.

@fkling fkling Jul 16, 2024

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This interferes with having popovers be conditionally by triggered by click or hover. I think callsites should be responsible for hiding the popover as necessary.

However I think we can probably make this more ergonomic and automatically enable click to show/hide behavior on mobile, if we have some more time.

@camdencheek camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is so much more usable -- thank you!

Comment on lines 138 to 144

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should all keyboard shortcuts be hidden on mobile?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Probably. I can move that into the keyboard shortcut component instead.

Comment thread client/web-sveltekit/src/lib/dom.ts Outdated
Comment on lines 125 to 128

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this converts the opt out badge into a button that works on click on mobile (since hover is disabled).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The changes here are quite "rudimentary". I don't know how they affect the panel system though it shouldn't matter much on mobile.
Still it would be nice to think about properly supporting this use case and not just tack it on.

@fkling

fkling commented Jul 16, 2024

Copy link
Copy Markdown
Contributor Author

Made some additional updates to make the revision picker work. For this I added an additional option to the default popover config that allows the popover logic to move the popover to the cross axis.
It doesn't open fullscreen which deviates from the behavior of the other panels (fullscreen with close button), but that might be OK since it's not a panel and not a dialog either.

Before After
2024-07-17_00-42 2024-07-17_15-14

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not sure if that's the best way to go about. It requires that we set grid-area: in the other component. But maybe that's OK since they are related.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is it impossible to have overflow by X axes? What is the reason for this change

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With the new size middleware the actual size of the popover might be different from what the popover content expects or there might simply not enough space.
E.g the content of the search results progress button was too large to completely show vertically. In this case the popover should be scrollable.

You are right that this might also be the case horizontally, although in this case I'd expect the popover content to simply shrink/wrap.

Comment on lines 112 to 121

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Every time when someone uses a bitmask something good wakes up in my soul, thanks

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You split this into two strings, I'm just curious: Is this some new grid syntax? I thought that there should be no difference.

@camdencheek camdencheek Jul 17, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Each string is a space separated row, so this means:

title  timestamp
author author

fkling added 3 commits July 17, 2024 15:10
This is an initial attempty to improve the web app for small screens.
This commit makes the following changes for small screens:

- Search home page:
  - No more search input overflow
  - History button is rendered on same line as other action buttons
    (saves some vertical space)
- Search results page:
  - Search input is rendered in the page, not in the header (more space)
  - Filters sidebar is hidden by default and can be shown via a
    `Filters` button.
  - The filters sidebar opens fullscreen and has a close button
  - The progrss button is smaller due to showing less information
- Repository pages:
  - File sidebar is hidden by default. It can be shown via a new button
    that is visible in the file headers
  - The file sidebar opens fullscreen and has a close button
  - NOTE: Selecting a file currently does not close the file sidebar,
    navigation happens in the background
  - Cody sidebar opens fullscreen and has the same close button
- General:
  - Fuzzy finder opens fullscreen and has a larger close button
  - Tabs don't show keyboard shortcuts

I tried to stick to CSS as much as possible but for some things to work
I had to change component structures or rendered elements conditionally.
Specifically when a component was already using `$isViewportMobile` I
usually just rendered elements conditionally.

I extended the `Panel` component to have a special 'mobile' mode, since
I realized I was doing similar changes to the filters, file tree and
cody sidebar.
The cody sidebar is a bit of a special case though because it's not
even rendered by default. So there are some additional steps required to
sync the open state.
@fkling fkling force-pushed the fkling-srch-730-low-lift-mobile-support branch from e286f45 to ef4fd34 Compare July 17, 2024 13:10
@fkling fkling force-pushed the fkling-srch-730-low-lift-mobile-support branch from ef4fd34 to 1eb94ef Compare July 17, 2024 13:14
@fkling

fkling commented Jul 17, 2024

Copy link
Copy Markdown
Contributor Author

I changed the keyboard shortcuts component to not render on mobile and update the history panel and diff view to look a bit better:

Before After
2024-07-17_15-07 2024-07-17_15-14

@fkling fkling merged commit d2b6ffa into main Jul 17, 2024
@fkling fkling deleted the fkling-srch-730-low-lift-mobile-support branch July 17, 2024 14:11
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.

3 participants