-
-
Notifications
You must be signed in to change notification settings - Fork 7
feat(MeiliSearch): update css #584
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -112,7 +112,7 @@ public partial class MeiliSearchBox | |
| [Parameter] | ||
| public RenderFragment? FooterTemplate { get; set; } | ||
|
|
||
| private string? ClassString => CssBuilder.Default("bb-g-search") | ||
| private string? ClassString => CssBuilder.Default("bb-g-search visually-hidden") | ||
|
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. issue: Adding 'visually-hidden' to the root class may affect layout and accessibility. If you intend to keep the search container accessible while hiding it visually, use a utility class or ARIA attributes designed for that purpose. Also, verify that visibility toggling works as expected on initialization. |
||
| .AddClassFromAttributes(AdditionalAttributes) | ||
| .Build(); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,6 +10,11 @@ if (window.BootstrapBlazor === void 0) { | |||||||||||||||||||||||||||||
| export async function init(id, options) { | ||||||||||||||||||||||||||||||
| const el = document.getElementById(id); | ||||||||||||||||||||||||||||||
| await addLink('_content/BootstrapBlazor.MeiliSearch/meilisearch.css'); | ||||||||||||||||||||||||||||||
| el.classList.remove('visually-hidden'); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const mask = el.querySelector('.search-dialog-mask'); | ||||||||||||||||||||||||||||||
| mask.classList.remove("d-none"); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| await addScript('_content/BootstrapBlazor.MeiliSearch/meilisearch.umd.min.js'); | ||||||||||||||||||||||||||||||
|
Comment on lines
12
to
18
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. suggestion (bug_risk): Directly removing 'visually-hidden' class may cause layout shifts if initialization is delayed. Ensure the element is revealed only after all required resources are loaded to prevent layout shifts or flashes of unstyled content.
Suggested change
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| const search = { | ||||||||||||||||||||||||||||||
|
|
@@ -23,7 +28,7 @@ export async function init(id, options) { | |||||||||||||||||||||||||||||
| blockTemplate: el.querySelector('.search-dialog-block-template'), | ||||||||||||||||||||||||||||||
| emptyTemplate: el.querySelector('.search-dialog-empty-template'), | ||||||||||||||||||||||||||||||
| dialog: el.querySelector('.search-dialog'), | ||||||||||||||||||||||||||||||
| mask: el.querySelector('.search-dialog-mask') | ||||||||||||||||||||||||||||||
| mask: mask | ||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||
| Data.set(id, search); | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,40 @@ | ||||||||||||||||||||||||||||||||||
| .search-dialog-mask { | ||||||||||||||||||||||||||||||||||
| .bb-g-search { | ||||||||||||||||||||||||||||||||||
| --bb-global-search-padding: 0.25rem 0.75rem; | ||||||||||||||||||||||||||||||||||
| --bb-global-search-width: 168px; | ||||||||||||||||||||||||||||||||||
| display: flex; | ||||||||||||||||||||||||||||||||||
| align-items: center; | ||||||||||||||||||||||||||||||||||
| border: var(--bs-border-width) solid var(--bs-border-color); | ||||||||||||||||||||||||||||||||||
| border-radius: var(--bs-border-radius); | ||||||||||||||||||||||||||||||||||
| padding: var(--bb-global-search-padding); | ||||||||||||||||||||||||||||||||||
| width: var(--bb-global-search-width); | ||||||||||||||||||||||||||||||||||
| transition: border-color .3s linear; | ||||||||||||||||||||||||||||||||||
| color: rgba(var(--bs-body-color-rgb), 0.5); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| .bb-g-search:hover { | ||||||||||||||||||||||||||||||||||
| border: var(--bs-border-width) solid var(--bb-border-hover-color); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| .bb-g-search > input { | ||||||||||||||||||||||||||||||||||
| width: 100%; | ||||||||||||||||||||||||||||||||||
| background-color: transparent; | ||||||||||||||||||||||||||||||||||
| border: none; | ||||||||||||||||||||||||||||||||||
| line-height: 1.5; | ||||||||||||||||||||||||||||||||||
| padding: 0; | ||||||||||||||||||||||||||||||||||
| cursor: pointer; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+18
to
+25
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. suggestion: Consider using 'cursor: text' for input fields instead of 'pointer'. Using 'cursor: pointer' on text inputs can confuse users and affect accessibility. If the input is not editable and opens a dialog, make the interaction clear.
Suggested change
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| .bb-g-search > input::placeholder { | ||||||||||||||||||||||||||||||||||
| color: rgba(var(--bs-body-color-rgb), 0.5); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| .search-dialog-icon { | ||||||||||||||||||||||||||||||||||
| cursor: pointer; | ||||||||||||||||||||||||||||||||||
| font-size: 18px; | ||||||||||||||||||||||||||||||||||
| margin-inline-end: .5rem; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| .search-dialog-mask { | ||||||||||||||||||||||||||||||||||
| --bb-global-search-item-active-bg: rgba(var(--bs-emphasis-color-rgb), 0.2); | ||||||||||||||||||||||||||||||||||
| --bb-global-search-item-hover-bg: rgba(var(--bs-emphasis-color-rgb), 0.1); | ||||||||||||||||||||||||||||||||||
| --bb-global-search-dialog-input-focus-border-color: rgba(var(--bs-emphasis-color-rgb), 0.4); | ||||||||||||||||||||||||||||||||||
|
|
@@ -8,6 +44,15 @@ | |||||||||||||||||||||||||||||||||
| --bb-global-search-main-max-height: calc(100vh - 260px); | ||||||||||||||||||||||||||||||||||
| --bb-global-search-footer-kbd-bg: var(--bs-body-color); | ||||||||||||||||||||||||||||||||||
| --bb-global-search-footer-kbd-color: var(--bs-body-bg); | ||||||||||||||||||||||||||||||||||
| position: fixed; | ||||||||||||||||||||||||||||||||||
| top: 0; | ||||||||||||||||||||||||||||||||||
| right: 0; | ||||||||||||||||||||||||||||||||||
| bottom: 0; | ||||||||||||||||||||||||||||||||||
| left: 0; | ||||||||||||||||||||||||||||||||||
| z-index: var(--bb-global-search-dialog-mask-z-index); | ||||||||||||||||||||||||||||||||||
| background-color: rgba(var(--bs-emphasis-color-rgb), 0.3); | ||||||||||||||||||||||||||||||||||
| justify-content: center; | ||||||||||||||||||||||||||||||||||
| display: none; | ||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
| display: none; |
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.
suggestion: Using both 'd-none' and 'display: none' in CSS may lead to specificity conflicts.
Standardize the method for toggling mask visibility to avoid CSS specificity issues and ensure consistent behavior.
Suggested implementation:
bool IsMaskVisibleproperty in your component's code-behind or@codeblock.IsMaskVisibletotrueorfalseas appropriate.style="display: none"for.search-dialog-maskin this file.