-
Notifications
You must be signed in to change notification settings - Fork 4
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
[frontend] add logic to open/close tasks on print #447
Conversation
6e3ed9a
to
f13518d
Compare
let details = [...document.querySelectorAll<HTMLDetailsElement>('details:not([open])')] | ||
for (let e of details) { | ||
e.setAttribute('open', '') | ||
e.dataset.wasclosed = '' | ||
} |
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.
Use const
and open the details
element by using open
property setter with true
.
let details = [...document.querySelectorAll<HTMLDetailsElement>('details:not([open])')] | |
for (let e of details) { | |
e.setAttribute('open', '') | |
e.dataset.wasclosed = '' | |
} | |
const details = document.querySelectorAll<HTMLDetailsElement>('details:not([open])') | |
details.forEach((el) => { | |
el.open = true | |
el.dataset.wasclosed = '' | |
}) |
let details = [...document.querySelectorAll<HTMLDetailsElement>('details[data-wasclosed]')] | ||
for (let e of details) { | ||
e.removeAttribute('open') | ||
delete e.dataset.wasclosed | ||
} |
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.
Use const
and close the details
element by using open
property setter with false
.
let details = [...document.querySelectorAll<HTMLDetailsElement>('details[data-wasclosed]')] | |
for (let e of details) { | |
e.removeAttribute('open') | |
delete e.dataset.wasclosed | |
} | |
const details = document.querySelectorAll<HTMLDetailsElement>('details[data-wasclosed]') | |
details.forEach((el) => { | |
el.open = false | |
delete el.dataset.wasclosed | |
}) |
Note [22 June 2023]
I'm putting this in draft since the requirements have changed based on requests from the design team. This issue with the approach taken in this PR is that it will expand ALL groups/tasks, when the desired behaviour is to be able to toggle all groups/tasks open via a button, and then subsequently collapse groups/tasks the user doesn't want printed. In other words, this PR only allows for all accordions open in the print, and the user perhaps wants or needs finer control over the printed document.
This PR aims to solve the issue of opening all tasks on print. When printing is finished, all tasks that weren't previously opened should be closed, but the ones that were open should remain open. This also applies to the 3 timeline summaries.
Inspiration found here
Also removed an unused style in the global css.