-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat: add kbd hint #1495
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
Open
Venki1402
wants to merge
1
commit into
cp-algorithms:main
Choose a base branch
from
Venki1402:va/fix#1467
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat: add kbd hint #1495
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,4 +54,56 @@ body[dir=rtl] .metadata.page-metadata .contributors-text{ | |
|
||
.arithmatex{ | ||
overflow-y: hidden !important; | ||
} | ||
|
||
/* Keyboard hint for search ("/") */ | ||
.kbd-hint { | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
margin-left: 4px; | ||
padding: 0 6px; | ||
height: 22px; | ||
border-radius: 4px; | ||
border: 1px solid var(--md-default-fg-color--lightest, rgba(0,0,0,.2)); | ||
background: var(--md-default-bg-color, #fff); | ||
color: var(--md-default-fg-color, rgba(0,0,0,.87)); | ||
font: 500 12px/1 var(--md-text-font, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif); | ||
opacity: .72; | ||
} | ||
|
||
/* Show "/" hint inside the search input on desktop */ | ||
.md-search__form { | ||
position: relative; | ||
} | ||
|
||
.md-search__form::after { | ||
content: "/"; | ||
position: absolute; | ||
right: 10px; | ||
top: 50%; | ||
transform: translateY(-50%); | ||
display: inline-flex; | ||
align-items: center; | ||
justify-content: center; | ||
height: 20px; | ||
padding: 0 6px; | ||
border-radius: 4px; | ||
border: 1px solid var(--md-default-fg-color--lightest, rgba(0,0,0,.2)); | ||
background: var(--md-default-bg-color, #fff); | ||
color: var(--md-default-fg-color, rgba(0,0,0,.87)); | ||
font: 500 12px/1 var(--md-text-font, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif); | ||
opacity: .72; | ||
pointer-events: none; | ||
} | ||
|
||
/* Hide hint when typing/focused so it doesn't overlap text */ | ||
.md-search__form:focus-within::after, | ||
.md-search__form input:not(:placeholder-shown) + .md-search__icon ~ *::after { | ||
opacity: 0; | ||
} | ||
|
||
/* Only show on wider viewports where the inline search is visible */ | ||
@media (max-width: 959px) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this value defined? Can we somehow take it from the theme named constants? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not sure regd. that, can we take 60em instead? |
||
.md-search__form::after { display: none; } | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These seem to mostly repeat things that are already set in
.kbd-hint
. I'm not that well versed in CSS, is this really necessary? Why do we need them as two independent settings?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.
they’re separate because one is a DOM element and the other is a pseudo-element positioned inside the input. If we want both contexts covered (inside the field on desktop, next to the icon on mobile/when the field is hidden), we need both targets.
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.
What do you mean by next to the icon on mobile / when the field is hidden? For me, when the field is hidden, the hint is hidden as well?