Close accordions when settings modal closed#108
Conversation
…es tables) are now automatically collapsed when the modal is closed.
WalkthroughThe 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 Changes
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
Suggested labels
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
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
📒 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
hideSettingsmethod 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)
Summary by CodeRabbit