Skip to content

Commit

Permalink
[Fix #8] Fix collapse/expand dynamics of sections
Browse files Browse the repository at this point in the history
  • Loading branch information
blcham committed Dec 8, 2021
1 parent 290cc41 commit 93fabb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
15 changes: 9 additions & 6 deletions src/components/SectionComponent.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ export default class SectionComponent extends Question {
constructor(props) {
super(props);

const toggleCollapseSuper = this._toggleCollapse;
this._toggleCollapse = (e) => {
const toggleCollapseSuper = this.toggleCollapse;
this.toggleCollapse = (e) => {
let classList = e.target.classList;
if (!classList.contains('answer-content') && !classList.contains('card-header')) {
if (!classList.contains('answer-content') && !classList.contains('card-header')
&& !classList.contains('answer') && !classList.contains('show-advanced-switch')
&& !classList.contains('d-inline') && !classList.contains('caret-square-down')
&& !(classList.length === 0)
) {
return;
}
toggleCollapseSuper();
Expand Down Expand Up @@ -44,12 +48,11 @@ export default class SectionComponent extends Question {
);
}

_renderQuestionHelp() {
renderHeaderExtension() {
return (
<>
{super._renderQuestionHelp()}
{this._renderIdentifierText()}
{this._renderShowAdvanced()}
{this.state.expanded && this._renderShowAdvanced()}
</>
);
}
Expand Down
6 changes: 1 addition & 5 deletions src/styles/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,14 @@
display: inline-block;
text-align: center;
pointer-events: none;
margin-left: 30px;
margin-left: 6px;
color: #535353;
}

.text-white .section-identifier {
color: white;
}

.answer-content .section-identifier {
margin-left: 6px;
}

.card-header .answer-content .form-group {
display: inline-block;
}
Expand Down

0 comments on commit 93fabb9

Please sign in to comment.