Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't show this again toggle bug #460 #476

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

JoaoOliveira85
Copy link

Fixes #460

Summary of Changes

The "Don't Show This Again" toggle wasn't working correctly because the click event wasn't being captured. To fix this, I added an onClick to the dialog's

element to ensure that the toggle state is updated when clicked.

Screenshots (if necessary)

Additional context

Discord username (if different from GitHub):

Copy link
Member

@Benjozork Benjozork left a comment

Choose a reason for hiding this comment

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

Can you add a changelog entry to changelog.yml?

@JoaoOliveira85
Copy link
Author

Can you add a changelog entry to changelog.yml?

Excuse me but could you clarify? The changelog.yaml file seems to be auto generated. Do you want me to add a Unreleased line or something similar?

#   - name: Unreleased
#    changes:
#      - title: Fixed "show this again" toggle button on installer
#        categories: [UI]
#        authors: [JoaoOliveira85]

@FoxtrotSierra6829
Copy link
Member

The changelog file is not autogenerated. You have to write the content yourself. Just augment the version by one

@JoaoOliveira85
Copy link
Author

The changelog file is not autogenerated. You have to write the content yourself. Just augment the version by one

Gotcha! Updated :)

Copy link
Member

@FoxtrotSierra6829 FoxtrotSierra6829 left a comment

Choose a reason for hiding this comment

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

Unfortunately after testing and investigating I have to tell you this PR does not fix the issue, it just inverts it. The reason why clicking on the toggle itself didn't work in the past is that the click event was actually executed twice, once by the toggle and once by its parent. Now adding an onClick event to the parent's parent inverts this relationship again, so that clicking on the toggle actually triggers it 3 times, but everything around it will trigger 2 times and as such not work.

The solution is to let the onToggle() event of the Toggle that is triggered within the CompactYesNoOptionToggle and YesNoOptionToggle components do nothing.

Co-authored-by: Florian Scheuner <[email protected]>
@JoaoOliveira85
Copy link
Author

Good catch on that analysis. Your suggested solution does work but perhaps, instead of changing the expected behavior from the toggle it'd make more sense to use preventPropagation().

I'll try to get some time to take a look at it since, currently, the onClick attribute is only designed to handle a boolean inversion and doesn't pass the event along so I don't have access to the event methods to use preventPropagation. Since I'm not very familiar with the codebase I don't want to break anything. :)

Thanks again for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Dont Show This Again toggle switch does not trigger action
3 participants