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

Disable next/previous match buttons when no text is in Find box #15857

Merged
merged 12 commits into from
Mar 11, 2024

Conversation

JasonWeill
Copy link
Contributor

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:

Screenshot 2024-02-22 at 9 43 02 AM

When there is text in the Find box, the next and previous match buttons are enabled and work the same way as before:

Screenshot 2024-02-22 at 9 43 16 AM

Backwards-incompatible changes

None.

@JasonWeill JasonWeill added the bug label Feb 22, 2024
Copy link

Thanks for making a pull request to jupyterlab!
To try out this branch on binder, follow this link: Binder

@github-actions github-actions bot added pkg:documentsearch tag:CSS For general CSS related issues and pecadilloes Design System CSS labels Feb 22, 2024
@JasonWeill
Copy link
Contributor Author

@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.

@JasonWeill
Copy link
Contributor Author

The CSS rules are now updated to suppress hover and active effects on disabled buttons.

@krassowski krassowski added this to the 4.1.x milestone Feb 26, 2024
Copy link
Member

@krassowski krassowski left a 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;
Copy link
Member

Choose a reason for hiding this comment

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

When I hover over the debugger button when disabled it shows not allowed cursor. When I hover over the disable search buttons they show hand cursor. Should we align to the debugger button style?

Suggested change
opacity: 0.6;
opacity: 0.6;
cursor: not-allowed;

cursor-style

Copy link
Member

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).

Copy link
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 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.

packages/documentsearch/style/base.css Outdated Show resolved Hide resolved
packages/documentsearch/style/base.css Outdated Show resolved Hide resolved
opacity: 0.6;
}

.jp-DocumentSearch-overlay button:not(:disabled):hover {
Copy link
Member

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 buttons in their notebook our styles would not cause any performance penalty (of course until they start using jp-button).

JasonWeill and others added 3 commits February 27, 2024 10:32
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>
Copy link
Member

@krassowski krassowski left a comment

Choose a reason for hiding this comment

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

Tested locally works well:

works-ok

Thank you @JasonWeill!

@JasonWeill JasonWeill merged commit 6169fc7 into jupyterlab:main Mar 11, 2024
78 of 80 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Design System CSS pkg:documentsearch tag:CSS For general CSS related issues and pecadilloes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Find and replace next/previous buttons are active even when no text is in the find textbox
2 participants