Skip to content
This repository was archived by the owner on Aug 11, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 7 additions & 17 deletions explainers/hidden-content-explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ sections -- something that is not currently possible.
.collapsed > .title::before {
content: '➡️ ';
}

.details {
margin-left: 20px;
}
.collapsed > .details {
content-visibility: hidden-matchable;
}
</style>

Please explore the following sections:
Expand All @@ -101,22 +94,19 @@ Please explore the following sections:
</div>

<script>
function updateHiddenAttribute(section) {
const details = section.querySelector('.details');
if (section.classList.contains('collapsed')) {
details.setAttribute('hidden', 'until-found');
} else {
details.removeAttribute('hidden');
}
}
document.querySelectorAll('.section').forEach(section => {
section.onbeforematch = () => {
section.classList.remove('collapsed');
updateHiddenAttribute(section);
};
section.querySelector('.title').onclick = () => {
section.classList.toggle('collapsed');
updateHiddenAttribute(section);

const details = section.querySelector('.details');
if (section.classList.contains('collapsed')) {
details.hidden = 'until-found';
} else {
details.removeAttribute('hidden');
}
};
});
</script>
Expand Down