Skip to content

Close accordions when settings modal closed#108

Merged
tg666 merged 1 commit intomainfrom
feature/close-accordions-when-settings-modal-closed
Apr 24, 2025
Merged

Close accordions when settings modal closed#108
tg666 merged 1 commit intomainfrom
feature/close-accordions-when-settings-modal-closed

Conversation

@tg666
Copy link
Contributor

@tg666 tg666 commented Apr 24, 2025

Summary by CodeRabbit

  • Changed
    • Storage descriptions and cookies tables in the settings modal now automatically collapse when the modal is closed, improving the user experience when revisiting settings.

…es tables) are now automatically collapsed when the modal is closed.
@tg666 tg666 added the UX/UI UX/UI improvement label Apr 24, 2025
@tg666 tg666 self-assigned this Apr 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Apr 24, 2025

Walkthrough

The changes update the behavior of the settings modal in the cookie consent component. Now, when the settings modal is closed, any expanded storage description accordions within it are automatically collapsed. This is achieved by overriding the internal hideSettings method to include logic that collapses open accordions after the modal is hidden. Additionally, the changelog is updated to document this change under the "Unreleased" section.

Changes

File(s) Change Summary
CHANGELOG.md Updated the "Unreleased" section to document that storage descriptions and cookies tables in the settings modal auto-collapse.
src/CookieConsentWrapper.mjs Overrode the internal hideSettings method to collapse expanded storage description accordions when the settings modal closes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CookieConsentWrapper
    participant CookieConsent_Internal

    User->>CookieConsentWrapper: Close settings modal
    CookieConsentWrapper->>CookieConsent_Internal: hideSettings()
    CookieConsent_Internal-->>CookieConsentWrapper: Modal hidden
    CookieConsentWrapper->>CookieConsentWrapper: (after 250ms) Collapse expanded accordions
Loading

Suggested labels

enhancement

Poem

A bunny hops with glee and pride,
Accordions now close when you hide!
The settings modal, neat and tight,
Collapses all before the night.
With cookies tucked and changes logged,
The code is clean, the UI unclogged!
🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

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

Copy link

@coderabbitai coderabbitai bot left a comment

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 (3)
src/CookieConsentWrapper.mjs (2)

290-291: Consider using optional chaining for nullable references.

The current approach using logical AND operators works, but optional chaining would make the code more concise and modern.

-blockSection && blockSection.classList.remove('act');
-accordion && accordion.setAttribute('aria-hidden', 'true');
+blockSection?.classList.remove('act');
+accordion?.setAttribute('aria-hidden', 'true');
🧰 Tools
🪛 Biome (1.9.4)

[error] 290-290: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 291-291: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


283-293: Consider adding a comment explaining the timeout duration choice.

The 250ms timeout seems to be chosen to ensure the modal closing animation completes before collapsing accordions. A brief comment explaining this reasoning would improve code maintainability.

🧰 Tools
🪛 Biome (1.9.4)

[error] 290-290: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 291-291: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

CHANGELOG.md (1)

9-10: Fix subject-verb agreement in changelog entry.

The subject "Information" is singular, so the verb should be "is" rather than "are".

-### Changed
-- Information about storages in the settings modal (descriptions, cookies tables) are now automatically collapsed when the modal is closed.
+### Changed
+- Information about storages in the settings modal (descriptions, cookies tables) is now automatically collapsed when the modal is closed.
🧰 Tools
🪛 LanguageTool

[uncategorized] ~10-~10: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...gs modal (descriptions, cookies tables) are now automatically collapsed when the mo...

(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c71ccb2 and abe0c87.

📒 Files selected for processing (2)
  • CHANGELOG.md (1 hunks)
  • src/CookieConsentWrapper.mjs (2 hunks)
🧰 Additional context used
🪛 LanguageTool
CHANGELOG.md

[uncategorized] ~10-~10: This verb does not appear to agree with the subject. Consider using a different form.
Context: ...gs modal (descriptions, cookies tables) are now automatically collapsed when the mo...

(AI_EN_LECTOR_REPLACEMENT_VERB_AGREEMENT)

🪛 Biome (1.9.4)
src/CookieConsentWrapper.mjs

[error] 290-290: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 291-291: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (1)
src/CookieConsentWrapper.mjs (1)

279-294: Implementation looks good and achieves the desired behavior.

The override of the hideSettings method correctly closes any expanded accordions when the settings modal is closed. This improves the user experience by ensuring a clean state for the next time the modal is opened.

🧰 Tools
🪛 Biome (1.9.4)

[error] 290-290: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 291-291: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

@tg666 tg666 added the enhancement New feature or request label Apr 24, 2025
@tg666 tg666 merged commit a77173b into main Apr 24, 2025
2 checks passed
@tg666 tg666 deleted the feature/close-accordions-when-settings-modal-closed branch April 24, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request UX/UI UX/UI improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant