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 Our Events Card Glitch After Toggling and Resizing Window #6777

Merged
merged 3 commits into from
May 2, 2024

Conversation

tony1ee
Copy link
Member

@tony1ee tony1ee commented Apr 29, 2024

Fixes #6775

What changes did you make?

  1. (7e94b92) changed where eventListener is registered from .flex-page-card' to window
  2. (4262f25) added a condition before handleScreenResize() collapse cards to check if they have been manually unfolded, and if so, leave them unfolded

Why did you make the changes (we will use this info to test)?

  • change No.1 was made to address the main issue in #6775, making the eventListener properly registered (with the current way of registration it won't be triggered) so it can function as intended to reset the cards after resizing
  • change No.2 was made to address a issue that existed in the code before but was only exposed after change No.1 is made now that the function can be triggered: handleScreenResize() will reset (collapse) all cards every time the window size is #bp-below-tablet after resize. The problem is it cannot tell whether the previous state before resize event is also #bp-below-tablet. If the resize happens from a #bp-below-tablet width to another #bp-below-tablet width, the expected behavior is to leave the card as is, rather than resetting/collapsing it. By adding a condition to check if card was manually unfolded (by checking existence of active in class list), the unfolded cards will not be unexpectedly collapsed, therefore fixing the problem.

Screen Recordings of Proposed Changes Of The Website

Visuals before change 1 is applied

notice how the card will be empty after resizing from width 750 to width 800

b1

Visuals after change 1 is applied

notice how the card content remains after resizing from width 750 to width 800

a1

Visuals after change 1 is applied but before change 2 is applied

notice the card collapse unexpectedly while adjusting the width (<=767 the entire duration)

b2

Visuals after both change 1 and change 2 are applied

expected behavior: the unfolded card remains unfolded while adjusting the width (<=767 the entire duration)

a2

@github-actions github-actions bot added Bug Something isn't working role: front end Tasks for front end developers Complexity: Large P-Feature: Events https://www.hackforla.org/events/ size: 2pt Can be done in 7-12 hours labels Apr 29, 2024
@tony1ee tony1ee requested a review from gaylem April 29, 2024 03:15
Copy link
Member

@gaylem gaylem left a comment

Choose a reason for hiding this comment

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

Hey @tony1ee,

Amazing work on this issue! It functions as expected for me locally. You also set up your branch and linked out to the issue correctly. Well done!

One observation that probably doesn't matter:

  • I noticed that the drop-downs toggle shut when the when the screen is reduced from > 767 to < 767. This might cause user frustration if someone is reading the content and tries to shrink their screen. Could disorient them a bit.
  • It's such an edge case, though, and fixing that seems like it would be way more complicated than its worth in this instance. Besides, how would we know someone is reading the content? I think addressing this would require too much of a redesign and falls outside of the scope of this issue. Just thought I'd mention it in case anyone else felt the same way.

Otherwise, I only have nit-picky change requests:

  • This is optional, but if you'd like to clean up the code you modified to follow the (AirBnB style guide) that would look pretty. I haven't heard if we follow a specific style guide but this is the one I see most commonly used.
  • Given this feature is a bit finicky, would you mind adding some more comments to the event listener for future devs so they understand why it's built this way? JSDoc comments would also be rad, but you can do it however you want.

Thanks, dude! 👍

@gaylem
Copy link
Member

gaylem commented Apr 30, 2024

Note for other reviewers: The Add Pull Request Instructions check is failing because of #6778. The changes were reverted, but its still not working for this issue. Here's how I set up my branch locally so you don't have to figure it out:

git checkout -b tony1ee-fix-events-card-glitch-6775
git pull https://github.com/tony1ee/website.git fix-events-card-glitch-6775

Note for merge team: I'm guessing we can ignore that failed check and just squash and merge when this gets two approvals. Let me know if you disagree.

@Thinking-Panda Thinking-Panda self-requested a review May 1, 2024 02:18
Thinking-Panda
Thinking-Panda previously approved these changes May 1, 2024
Copy link
Member

@Thinking-Panda Thinking-Panda left a comment

Choose a reason for hiding this comment

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

@tony1ee , nice work with the issue. Code changes give expected result. Website works well on my local machine. I approve!

@tony1ee
Copy link
Member Author

tony1ee commented May 2, 2024

@gaylem Thanks for your thorough review.

You were correct to point out the behavior of the card when first switched to/loaded mobile view. I am not sure what is the expected behavior in terms of default card display. I would consider it out of scope of this issue and suggest doing an issue involving UI/UX to address it further.

As for your 2nd concern, I pushed another commit with comments and some format adjustments. I tried my best to balance between maintainability and keeping the changes within issue scope. Please let me know your thoughts!

@tony1ee tony1ee requested review from gaylem and Thinking-Panda May 2, 2024 07:41
Copy link
Member

@gaylem gaylem left a comment

Choose a reason for hiding this comment

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

@tony1ee I agree with your comments and the changes look great, approved!

@gaylem gaylem merged commit f2669b8 into hackforla:gh-pages May 2, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Complexity: Large P-Feature: Events https://www.hackforla.org/events/ role: front end Tasks for front end developers size: 2pt Can be done in 7-12 hours
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Our Events Card Glitch After Toggling and Resizing Window
3 participants