Skip to content

fix(button): fix dark mode toggle click - I201#206

Merged
DianaLease merged 9 commits intoaccordproject:mainfrom
teja-pola:teja/i201/fix-dark-mode-click
Mar 14, 2025
Merged

fix(button): fix dark mode toggle click - I201#206
DianaLease merged 9 commits intoaccordproject:mainfrom
teja-pola:teja/i201/fix-dark-mode-click

Conversation

@teja-pola
Copy link
Contributor

Closes #201

Fixes an issue where clicking on the outer container of the dark mode toggle unintentionally triggers the mode change. Now, only direct clicks on the button will toggle dark mode.

Changes

  • Fixed event listener placement to ensure only button clicks trigger dark mode.

  • Updated the ToggleDarkMode.tsx component to prevent unintended toggling.

  • Improved accessibility and UX by making the toggle interaction more precise.

Flags

n/a

Screenshots or Video

BEFORE

Untitled.video.-.Made.with.Clipchamp.2.mp4

AFTER

Untitled.video.-.Made.with.Clipchamp.3.mp4

Related Issues

Author Checklist

  • Ensure you provide a DCO sign-off for your commits using the --signoff option of git commit.
  • Vital features and changes captured in unit and/or integration tests
  • Commits messages follow AP format
  • Extend the documentation, if necessary
  • Merging to main from fork:branchname

@teja-pola teja-pola requested a review from a team as a code owner March 9, 2025 20:21
@netlify
Copy link

netlify bot commented Mar 9, 2025

Deploy Preview for ap-template-playground ready!

Name Link
🔨 Latest commit 4437a4e
🔍 Latest deploy log https://app.netlify.com/sites/ap-template-playground/deploys/67d365110d36a2000886c7d4
😎 Deploy Preview https://deploy-preview-206--ap-template-playground.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

checked={isDarkMode}
size={80}
/>
<div className="toggle-wrapper">
Copy link
Contributor

Choose a reason for hiding this comment

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

@teja-pola any reason why we have to wrap it inside another div. Is there a way to not use it, you should be wrapping a tag only if there are additional tags getting added. Let me know if you have a solution based on maintainability of the code.

Copy link
Contributor Author

@teja-pola teja-pola Mar 11, 2025

Choose a reason for hiding this comment

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

Hey @Owaiseimdad, I added the <div> wrapper to apply the .toggle-wrapper class, which ensures clicks only inside the actual toggle. Without it, the pointer-events rule in ToggleDarkMode.ts wouldn’t work as intended. However, I understand your concern about unnecessary wrappers. Its just happened as different developers have different practices writing the code. I’ll simplify the structure and make changes while ensuring maintainability of the code now.

Copy link
Contributor

Choose a reason for hiding this comment

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

@teja-pola there has to be a way to make sure who ever uses darktoogle anywhere in app, they should not be wrapping it inside the div. Let me see what are the other possibilities.

Copy link
Contributor Author

@teja-pola teja-pola Mar 13, 2025

Choose a reason for hiding this comment

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

@Owaiseimdad Its done. Please review now and ask to merge if everything is up.

Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Copy link
Member

@DianaLease DianaLease left a comment

Choose a reason for hiding this comment

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

Please update with the latest main & resolve conflicts

Signed-off-by: Dharma Teja <dteja2468@gmail.com>
@teja-pola teja-pola force-pushed the teja/i201/fix-dark-mode-click branch 2 times, most recently from deabded to e160618 Compare March 13, 2025 21:53
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Dharma Teja <dteja2468@gmail.com>
@teja-pola teja-pola force-pushed the teja/i201/fix-dark-mode-click branch from e160618 to 4437a4e Compare March 13, 2025 23:06
@teja-pola
Copy link
Contributor Author

@DianaLease updated to latest main, can you merge now

@DianaLease DianaLease merged commit 61c76db into accordproject:main Mar 14, 2025
7 checks passed
surya4419 pushed a commit to surya4419/template-playground that referenced this pull request Mar 14, 2025
* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

---------

Signed-off-by: Dharma Teja <dteja2468@gmail.com>
surya4419 pushed a commit to surya4419/template-playground that referenced this pull request Mar 14, 2025
* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

---------

Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: surya4419 <suryaa4419@gmail.com>
Owaiseimdad pushed a commit to Owaiseimdad/template-playground that referenced this pull request Mar 14, 2025
* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

* fix(button): fix dark mode toggle click - I201

Signed-off-by: Dharma Teja <dteja2468@gmail.com>

---------

Signed-off-by: Dharma Teja <dteja2468@gmail.com>
Signed-off-by: Owaise Imdad <owaiseimdad@gmail.com>
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.

Dark Mode Toggle activates on clicking outer container

3 participants