fix: update swal input visibility logic#2337
Conversation
- Modified CSS in jquery.sweetalert.css to refine the visibility of the default SweetAlert input fields. The new rule ensures that inputs are hidden unless the class 'show-input' is present on the alert or 'swal-input-show' is applied to the input itself.
WalkthroughScopes the SweetAlert text input hide rule to the modal context instead of globally, using .sweet-alert:not(.show-input) and .swal-input-show. Updates comments accordingly. The new scoped rule appears twice in the file. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
emhttp/plugins/dynamix/styles/jquery.sweetalert.css (2)
482-486: Consider covering other text-like input types (optional)If we ever render SweetAlert inputs as password/email/number/search, they won’t be hidden by default with the current selector. You can future-proof by including common text-like types.
Apply this diff if you want to broaden support:
-.sweet-alert:not(.show-input) input[type="text"]:not(.swal-input-show) { +.sweet-alert:not(.show-input) input[type="text"]:not(.swal-input-show), +.sweet-alert:not(.show-input) input[type="password"]:not(.swal-input-show), +.sweet-alert:not(.show-input) input[type="email"]:not(.swal-input-show), +.sweet-alert:not(.show-input) input[type="number"]:not(.swal-input-show), +.sweet-alert:not(.show-input) input[type="search"]:not(.swal-input-show) { display: none; }
200-202: Align the “show” rule with the new hide scope (optional)Not part of this diff, but related: .sweet-alert.show-input currently sets display:block for all inputs, which can unintentionally affect non-text inputs. Consider limiting it to text-like inputs and preserving the .swal-input-show escape hatch.
Outside the changed hunk, consider updating as follows:
/* current */ .sweet-alert { /* ... */ &.show-input input { display: block; } } /* suggested */ .sweet-alert { /* ... */ &.show-input input[type="text"], &.show-input input.swal-input-show { display: block; } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
emhttp/plugins/dynamix/styles/jquery.sweetalert.css(1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-06-02T21:51:01.477Z
Learnt from: zackspear
PR: unraid/webgui#2222
File: emhttp/plugins/dynamix/styles/jquery.sweetalert.css:610-640
Timestamp: 2025-06-02T21:51:01.477Z
Learning: In the Unraid webgui codebase, SweetAlert button styling is handled through CSS inheritance from general button selectors in default-base.css rather than component-specific `.sweet-alert button` selectors. SweetAlert buttons inherit styling from the general `button`, `button[type="button"]`, `input[type="button"]`, and `a.button` selectors.
Applied to files:
emhttp/plugins/dynamix/styles/jquery.sweetalert.css
🔇 Additional comments (2)
emhttp/plugins/dynamix/styles/jquery.sweetalert.css (2)
482-486: Scoped input-hiding is correct and fixes the global suppressionLimiting the hide rule to the SweetAlert context with an opt-in via .show-input/.swal-input-show is a solid improvement and avoids unintended global side effects.
482-486: Scoped Input Hide Rule VerifiedConfirmed that the
.sweet-alert:not(.show-input) input[type="text"]:not(.swal-input-show)rule appears only once inemhttp/plugins/dynamix/styles/jquery.sweetalert.cssand no legacy unscoped hide rule remains. No duplicates found—no further action needed.
Summary by CodeRabbit
Bug Fixes
Style