Skip to content

Workbench miss relayout after viewport size changes #108267

Closed

Description

@rebornix

Only reproducible on Codespace on iPadOS.

Steps to Reproduce:

  1. Open Codespace on iPadOS 14.
  2. Type in either the editor or terminal, the keyboard help toolbar shows up
  3. Click the keyboard icon on the toolbar (rightmost) to hide the toolbar
  4. The workbench should resize itself when the toolbar shows or hides

We listen to resize event on window.visualViewport

this._register(addDisposableListener(viewport, EventType.RESIZE, () => workbench.layout()));
on iPadOS but

  • when testing OSS, I can never reproduce
  • when testing codespace, I can reproduce more than 50% of the time
  • In Safari Devtools, if I add a resize listener to window.visualViewport and print the viewport size when it changes, it always emits the event when the viewport resizes. It might mean that Safari is emitting events out correctly.
  • In Safari Devtools, whenever I open the bundled js or try to inspect the workbench Dom element, devtools crash so I can't debug at all

Benjamin Pasero (@bpasero) do you have ideas about how we can add some log (maybe emit to outputs channel, behind a flag) and then we can continue our investigation which part might misbehave?

Does this issue occur when all extensions are disabled?: Yes/No

Activity

  1. bpasero commented on Oct 8, 2020

    @bpasero
    Contributor

    Peng Lyu (@rebornix) looks like the log level was not properly wired in for web, I pushed a change and now you can set the log level as query param to get trace output. I would suggest you add this debug info as logService.trace.

    URL: http://localhost:8080/?payload=[[%22verbose%22,%22true%22],[%22logLevel%22,%22trace%22]]

  2. added
    layout
    web
    on Oct 8, 2020
  3. added a commit that references this issue on Oct 13, 2020
  4. rebornix commented on Oct 15, 2020

    @rebornix
    ContributorAuthor

    Successfully debug Codespace with Safari Dev Tools, I found the root cause is how Codespace wraps VS Code workbench. The DOM structure is like

    - body
      - div.vscs-dev-panel
      - div.vscs-workbench-body
        - vscode workbench
    

    In our workbench, we layout the workbench by following rules

    • If the container of the workbench is not document.body, use the container's dimension
    • If its container is document.body, then use window.visualViewport on iOS, window on other platforms

    In Codespace environment, VS Code workbench is not document.body, so we will always use its dimension as the workbench's dimension. Since its container is not resized properly, sometimes it becomes larger than the visual viewport.

    We can't always use window.visualViewport as the size (or maxSize) of the workbench as its container's size can be smaller than visualViewport, due to the existence of div.vscs-dev-panel.

    The current recommended fix for this issue is Codespace resizes div.vscs-workbench-body properly based on visual viewport change. Created a tracking issue in Codespace https://github.com/github/codespaces/issues/1443

  5. rebornix commented on Oct 15, 2020

    @rebornix
    ContributorAuthor

    As explained above, changes need to be made in embedder. Closing it as it's already being tracked by upstream, nothing needs to be done from our side.

  6. locked and limited conversation to collaborators on Dec 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

ghcs-adoption-neededgithub-codespacesios-ipadoslayoutweb

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions