fix #183: conditional hiding fixed with proper styling - #197
Open
iantrich wants to merge 1 commit into
Open
Conversation
Collaborator
|
Cannot confirm. The icon is always "mdi:bell-cancel" and is not hidden when unlocked. To create a JS file, I manually copied package.json & yarn.lock from this PR into my VSC, ran "yarn install", then ran a task "npm: build". May be my dev env differs from yours - so my generated JS files is somehow "wrong". Also, I honestly not getting fully the proposed changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

fixes #183
🔍 The Root Cause
The reason
unlocked_iconworked in version1.2.19but broke in thebeta 2release is due to the underlying migration to Lit 3.In older versions of
lit-html(used bylit-elementin v1.2.19), theclassMapdirective had a quirk where it would indiscriminately wipe out any classes that were added imperatively (e.g., viaclassList.add()) if they weren't explicitly keys inside theclassMap.In your
_handleRestrictionfunction, you were imperatively settinglock.classList.add('icon-hidden')andoverlay.classList.add('unlocked'). In1.2.19, whenthis._unlocked = truetriggered a render,classMapsimply blew those imperative classes away. This accidental behavior "fixed" theunlocked_iconvisibility because it prevented the icon and its container from fading out to opacity0.Now that you've migrated to Lit 3,
classMapcorrectly preserves imperatively added classes. Consequently, theicon-hiddenclass stays on the element, hiding the icon even when anunlocked_iconis explicitly provided.🛠️ The Solution
I have updated
src/restriction-card.tson yourbetabranch with the following logical fixes:_handleRestriction, theicon-hiddenandunlockedclasses are now only applied if the user did not configure anunlocked_icon. If an icon is provided, the card remains visible, but pointer events are still disabled to allow interaction with the underlying card.icon-unlockedclass mapping toclassMapand added it to thecssblock so that the unlocked icon takes on the success color (var(--restriction-success-lock-color)), matching the expected behavior.