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

543 fixing Plot setting panel icon #181

Merged
merged 4 commits into from
Aug 24, 2023
Merged

Conversation

kartikeyakirar
Copy link
Contributor

this fixes insightsengineering/teal.modules.general#543

Here I have added Jquery to toggle icon and added class card-heading to identify target div() bs4/bs5 version.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2023

badge

Code Coverage Summary

Filename                   Stmts    Miss  Cover    Missing
-----------------------  -------  ------  -------  --------------------------------------------
R/basic_table_args.R          23       0  100.00%
R/draggable_buckets.R         82      82  0.00%    57-152
R/get_dt_rows.R               13      13  0.00%    27-39
R/ggplot2_args.R              49       0  100.00%
R/include_css_js.R             7       1  85.71%   17
R/optionalInput.R            225     182  19.11%   87-362, 414, 465, 471, 486-499
R/panel_group.R               90      90  0.00%    12-132
R/plot_with_settings.R       382      21  94.50%   272-285, 344-345, 356-357, 607-608, 610, 612
R/standard_layout.R           35       0  100.00%
R/table_with_settings.R      173       1  99.42%   79
R/utils.R                     11       1  90.91%   7
R/verbatim_popup.R            99      49  50.51%   63-78, 104-105, 107, 115-143, 164
R/white_small_well.R           7       7  0.00%    18-24
TOTAL                       1196     447  62.63%

Diff against main

Filename           Stmts    Miss  Cover
---------------  -------  ------  --------
R/panel_group.R       +1      +1  +100.00%
TOTAL                 +1      +1  -0.05%

Results for commit: 69d0132

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@github-actions
Copy link
Contributor

github-actions bot commented Aug 21, 2023

Unit Tests Summary

    1 files    10 suites   16s ⏱️
101 tests 101 ✔️ 0 💤 0
208 runs  208 ✔️ 0 💤 0

Results for commit 71bfdba.

♻️ This comment has been updated with latest results.

@chlebowa
Copy link
Contributor

Something isn't right. The first click does not affect the icon.

plot_settings.mp4

@kartikeyakirar
Copy link
Contributor Author

kartikeyakirar commented Aug 21, 2023

I am not able to reproduce this. I am testing in chrome in mac and window

Screen.Recording.2023-08-21.at.6.26.02.PM.mov
Screen.Recording.2023-08-21.at.6.30.16.PM.mov

@chlebowa
Copy link
Contributor

I am on Ubuntu 20.04 and use Brave, which is Version 1.57.47 Chromium: 116.0.5845.96 (Official Build) (64-bit)

@kartikeyakirar
Copy link
Contributor Author

kartikeyakirar commented Aug 21, 2023

Something isn't right. The first click does not affect the icon.

Understood, it appears that the problem is limited to Bootstrap version 5. It seems to be functioning correctly in versions 3 and 4.

Can you please confirm if you are using Bootstrap version 5? I am only able to reproduce the issue in BS 5.

@chlebowa
Copy link
Contributor

Actually, it works fine with when I set options("teal.bs_theme" = bslib::bs_theme(version = 5)).
The problem arises in versions 3 and 4.

@kartikeyakirar
Copy link
Contributor Author

That's quite intriguing! My system is actually experiencing the complete opposite. 😄. I might have identify the issue but I'm uncertain how it's impacting various versions on different systems. let me fix all version in my system and hopefully it will fix in all system aswell.

@kartikeyakirar kartikeyakirar mentioned this pull request Aug 23, 2023
@kartikeyakirar
Copy link
Contributor Author

kartikeyakirar commented Aug 23, 2023

When using .click() or similar event registration methods in jQuery, an event handler is attached to the target element. However, each time the element is clicked, a new event handler is added, causing multiple event handlers to execute and leading to unexpected behavior.

screenshot for single click
image

To fix this I have used event delegation here.

There is a similar implementation called teal.slice:::toggle_icon, but it requires server-side processing, so I didn't use it here.

DEMO

Screen.Recording.2023-08-23.at.7.06.46.PM.mov

Merge branch 'main' into 543_panel_icon@main

# Conflicts:
#	tests/testthat/_snaps/app_pws_ui/plot_with_settings_ui/pws-download_menu.png
#	tests/testthat/_snaps/app_pws_ui/plot_with_settings_ui/pws-hidden.png
#	tests/testthat/_snaps/app_pws_ui/plot_with_settings_ui/pws-resize_menu.png
#	tests/testthat/_snaps/app_pws_ui/plot_with_settings_ui/pws-visible.png
@kartikeyakirar kartikeyakirar requested a review from a team August 23, 2023 13:40
Copy link
Contributor

@chlebowa chlebowa left a comment

Choose a reason for hiding this comment

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

Yup, that's better 👍

@kartikeyakirar kartikeyakirar merged commit 9e51e67 into main Aug 24, 2023
20 checks passed
@kartikeyakirar kartikeyakirar deleted the 543_panel_icon@main branch August 24, 2023 12:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: In tm_variable_browser Plot setting panel icon is misleading.
2 participants