-
Notifications
You must be signed in to change notification settings - Fork 605
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 1830004: Add listener for keys in search page #5248
Bug 1830004: Add listener for keys in search page #5248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @bipuladh. This will need a Bugzilla to fix in 4.5.
@@ -83,7 +86,7 @@ const AutocompleteInput: React.FC<AutocompleteInputProps> = (props) => { | |||
ref={textInputRef} | |||
/> | |||
<span className="form-control-feedback form-control-feedback--keyboard-hint"> | |||
<kbd>/</kbd> | |||
<kbd>{!isActive ? `/` : 'Esc'}</kbd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change is a bit more confusing than helpful. We're overloading what the hint means. Previously it always meant focus this element, now it means different things depending on the state. I prefer the previous behavior of just removing the hint on focus.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I notice we're no longer removing the /
keyboard hint in other places when the input is focused. That looks like a bug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh okay. I will remove the Esc
. And yes we were missing on the hiding part. I realized while writing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frontend/public/style/_forms.scss
Outdated
.co-query-filter:focus + .form-control-feedback--keyboard-hint { | ||
right: 10px; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this change isn't needed if we remove the Esc
hint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
const textInputKeyHandler = { | ||
Escape: KeyEventModes.HIDE, | ||
'/': KeyEventModes.FOCUS, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this a common component instead of repeating it in multiple places? That way we consistently have the same keybindings and behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will move it to shared.
frontend/packages/console-shared/src/hooks/document-listener.ts
Outdated
Show resolved
Hide resolved
401c3f2
to
23085cb
Compare
@bipuladh: This pull request references Bugzilla bug 1830004, 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
In response to this:
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. |
@bipuladh: This pull request references Bugzilla bug 1830004, which is valid. 3 validation(s) were run on this bug
In response to this:
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. |
/kind bug |
/retest |
f4347c7
to
3b5226e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, nice to see so much code removed switching to a common component 👍
frontend/packages/console-shared/src/hooks/document-listener.ts
Outdated
Show resolved
Hide resolved
c0f4e17
to
8d38e86
Compare
@bipuladh Looks like you introduced a test failure. |
expect(input.props().onChange).toEqual(onChange); | ||
expect(input.props().onChange()).toEqual(((e) => onChange(e))()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change still needed? I thought we went back to onChange={onChange}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/approve
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bipuladh, spadgett 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 |
Thanks @bipuladh, looks good 👍 |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@bipuladh: All pull requests linked via external trackers have merged: openshift/console#5248. Bugzilla bug 1830004 has been moved to the MODIFIED state. In response to this:
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. |
Scrshots:
Mobile view:
/assign @spadgett