Skip to content

fix: update swal input visibility logic#2337

Merged
limetech merged 1 commit into
masterfrom
fix/swal-inputs
Aug 15, 2025
Merged

fix: update swal input visibility logic#2337
limetech merged 1 commit into
masterfrom
fix/swal-inputs

Conversation

@zackspear

@zackspear zackspear commented Aug 14, 2025

Copy link
Copy Markdown
Contributor
  • 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.

Summary by CodeRabbit

  • Bug Fixes

    • Resolved an issue where text input fields across the UI could be hidden unintentionally. Input visibility is now correctly scoped to SweetAlert dialogs.
    • Within SweetAlert, inputs remain hidden by default unless the dialog has the show-input class or the input has swal-input-show, ensuring consistent behavior.
  • Style

    • Refined CSS rules to limit input-hiding behavior to SweetAlert components, preventing unintended side effects elsewhere in the interface.

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

coderabbitai Bot commented Aug 14, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Scopes 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

Cohort / File(s) Summary
SweetAlert input visibility CSS
emhttp/plugins/dynamix/styles/jquery.sweetalert.css
Replaced global hide selector for text inputs with scoped selector: .sweet-alert:not(.show-input) input[type="text"]:not(.swal-input-show) { display:none; }. Updated comments. The scoped rule was inserted twice (duplicate).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested labels

7.2

Suggested reviewers

  • ljm42

Poem

A bunny taps CSS with gentle might,
Hiding inputs only when the modals bite.
show-input shows, swal-input glows—
No more vanishing fields where the wild wind blows.
Hop-hop! Two rules? I’ll prune tonight.

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
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/swal-inputs

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@zackspear zackspear requested a review from ljm42 August 14, 2025 22:39

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 7ff00c2 and a393306.

📒 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 suppression

Limiting 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 Verified

Confirmed that the .sweet-alert:not(.show-input) input[type="text"]:not(.swal-input-show) rule appears only once in emhttp/plugins/dynamix/styles/jquery.sweetalert.css and no legacy unscoped hide rule remains. No duplicates found—no further action needed.

@ljm42 ljm42 added the 7.2 label Aug 14, 2025
@limetech limetech merged commit c0a544f into master Aug 15, 2025
4 checks passed
@limetech limetech deleted the fix/swal-inputs branch August 15, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants