-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Disable next/previous match buttons when no text is in Find box #15857
Disable next/previous match buttons when no text is in Find box #15857
Conversation
Thanks for making a pull request to jupyterlab! |
@krassowski With the most recent code pushed to this branch, the buttons now appear dimmed (less opacity) when the Find box is empty, but they still show a different background color on hover. I can pick this back up tomorrow. |
The CSS rules are now updated to suppress hover and active effects on disabled buttons. |
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.
Looks good in general, some tiny suggestions to consider.
@@ -34,11 +34,15 @@ | |||
outline: 0; | |||
} | |||
|
|||
.jp-DocumentSearch-overlay button:hover { | |||
.jp-DocumentSearch-overlay button.jp-DocumentSearch-button-wrapper:disabled { | |||
opacity: 0.6; |
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.
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.
Also debugger button uses 0.4 opacity (I do not have a preference here).
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 don't see the pointer cursor on the prev/next buttons in Firefox ESR, and the cursor: not-allowed
rule doesn't seem to change the cursor to the 🚫 cursor as your animation shows.
opacity: 0.6; | ||
} | ||
|
||
.jp-DocumentSearch-overlay button:not(:disabled):hover { |
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.
Performance: having a generic element with three pseudo-elements on the right hand side of selector is not great. I don't feel like fiddling with it, but one way to make it work and eliminate performance impact would be making all the buttons within .jp-DocumentSearch-overlay
use a common class name (in addition to the specific class names they already have). Another solution would be switching to jp-button
element from ui-compontents
which is only slightly better than button
because if user has 1000s native button
s in their notebook our styles would not cause any performance penalty (of course until they start using jp-button
).
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
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.
References
Fixes #15813.
Code changes
Disables the next and previous match buttons when there is no text in the Find box.
User-facing changes
When no text is in the Find box, the next and previous match buttons are disabled, do nothing when clicked, and appear with 60% opacity, the same level used for disabled commands in the command palette:
When there is text in the Find box, the next and previous match buttons are enabled and work the same way as before:
Backwards-incompatible changes
None.