-
-
Notifications
You must be signed in to change notification settings - Fork 968
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 inconsistent behavior of code-folding buttons #2085
Conversation
The events were firing when hiding finished and showing started. This update makes all show/hide started/finished combinations visible to CSS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test it but it sounds about right to me. I'll let @cderv review it later. Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me too. I tested it and it works ok now. Thanks for catching this.
One question though: Why add some temporary classes between hide
and hidden
(code-collapsing
) and show
and shown
(code-expanding
)?
Bootstrap adds an intermediate class ( You could get away only defining the |
Oh so this is useful for styling during the transition ? I never done it myself. You could target I am just trying to understand completely as I want to avoid adding a specific class in rmarkdown if it is not necessary. |
Good question. That's what I tried first. Unfortunately, bootstrap already has styles that apply to Bootstrap's |
Oh that makes complete sense ! Then new class it is ! What about |
Sure. I have no attachement to the class name. I can update it to |
I'll do it and merge. I wonder where we should document that. I'll put it in NEWS only for now. Thanks a lot @steveharoz ! |
Cool. Cheers! |
✔ When a block of code is initialized as hide, that block's show/hide button updates when pressed. The button's
aria-expanded
attribute is set to true/false, and it adds/removes the classcollapsed
as expected.❌ But when a block of code is initialized as show, that block's show/hide button is locked with
aria-expanded="true"
and nocollapsed
class.This issue has accessibility implications and limits customizing the css of the button.
To reproduce
css: style.css
) with the codebutton.code-folding-btn[aria-expanded = "false"] {background-color: blue;}
code-folding:show
and knit as HTML.code-folding:hide
, and it updates.What the fix does
Expanded code blocks are currently shown before the button is created. This fix just defers until the button is already added.
Session info