Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1983220: Fix pod terminal second scrollbar when user reduce the window size #9534

Merged
merged 1 commit into from Jul 19, 2021

Conversation

jerolimov
Copy link
Member

@jerolimov jerolimov commented Jul 16, 2021

Fixes:
https://issues.redhat.com/browse/ODC-5630
https://bugzilla.redhat.com/show_bug.cgi?id=1983220

Analysis / Root cause:
Xterm uses an invisible textarea to detect keyboard events. This textarea has an absolute position and was permanently moved when the cursor position is changed. But this does not happen when the user resizes the window.

Bad positioned textarea:

textarea-position

Solution Description:
This was NOT solved by updating xterm to 4.13.0. Hoped that because I found this issue: xtermjs/xterm.js#3169

Open a new xterm issue: xtermjs/xterm.js#3390

As workaround call the internal _syncTextArea when the window was resized. This method was currently only called when the cursor moved: https://github.com/xtermjs/xterm.js/blob/4.10.0/src/browser/Terminal.ts#L474-L477

Screen shots / Gifs for design review:

Broken before in Chrome:

broken-chrome

Broken before in Firefox:

broken-firefox

Fixed in Chrome:

fixed-chrome

Fixed in Firefox:

fixed-firefox

Unit test coverage report:
Unchanged.

Test setup:

  1. Create a Deployment
  2. Open Pod detail page and switch to "Terminal" tab
  3. Create a long output, for example via find . or find /
  4. Reduce the window height

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci openshift-ci bot added component/core Related to console core functionality approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 16, 2021
@jerolimov
Copy link
Member Author

/cc @sahil143
Can you review this change? Thanks :)

@openshift-ci openshift-ci bot requested a review from sahil143 July 16, 2021 12:10
Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

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

@jerolimov I opened a bugzilla bug against OCP Management Console to make merging this easier, but see my comments about narrowing down the changes in this PR.

@@ -116,8 +115,11 @@ class Terminal_ extends React.Component {
this.fitAddon.fit();
// update the pty
this.props.onResize(terminal.rows, terminal.cols);
// The internal xterm textarea was not repositioned when the window was resized.
// This workaround triggers an position update.
this.terminal._core?._syncTextArea?.();
Copy link
Member

Choose a reason for hiding this comment

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

Correct me if I'm wrong, but this seems to be the only line needed to fix the bug. I would prefer that the rest of the changes (besides your comments here) be removed from the PR as they don't seem to be relevant to this bug fix.

Copy link
Member Author

Choose a reason for hiding this comment

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

@TheRealJon your right, and it also make sense to keep this PR small. I dropped all other changes and retested the fix, still works fine. PTAL.

@TheRealJon TheRealJon changed the title Fix pod terminal second scrollbar when user reduce the window size Bug 1983220: Fix pod terminal second scrollbar when user reduce the window size Jul 16, 2021
@openshift-ci openshift-ci bot added the bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. label Jul 16, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 16, 2021

@jerolimov: This pull request references Bugzilla bug 1983220, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @yapei

In response to this:

Bug 1983220: Fix pod terminal second scrollbar when user reduce the window size

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jul 16, 2021
@openshift-ci openshift-ci bot requested a review from yapei July 16, 2021 21:20
As workaround to fix invalid textarea position when the user resize the browser window
Copy link
Member

@TheRealJon TheRealJon left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 19, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 19, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jerolimov, TheRealJon

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 21bf403 into openshift:master Jul 19, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 19, 2021

@jerolimov: All pull requests linked via external trackers have merged:

Bugzilla bug 1983220 has been moved to the MODIFIED state.

In response to this:

Bug 1983220: Fix pod terminal second scrollbar when user reduce the window size

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.9 milestone Jul 26, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 28, 2021

@jerolimov: All pull requests linked via external trackers have merged:

Bugzilla bug 1983220 has been moved to the MODIFIED state.

In response to this:

Bug 1983220: Fix pod terminal second scrollbar when user reduce the window size

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants