Skip to content

Commit

Permalink
Fixes for responsible mobile design (#242)
Browse files Browse the repository at this point in the history
- Ensure that buttons text don't overflow using `white-space: normal`
- Ensure that user-provided text (election/question title, description,
  answers..) use `word-break: break-word` css setting to break the words
  in two if required because overflowing.
- Ensure that the warning messages in the affix-bottom during ballot
  selection doesn't prevent the next button to show nor they take too
  much space, by adding `overflow-y: scroll` to that section.
- Ensure power-by doesn't take two lines
  • Loading branch information
edulix committed Jun 8, 2022
1 parent 3629deb commit e62dc19
Show file tree
Hide file tree
Showing 20 changed files with 105 additions and 28 deletions.
1 change: 1 addition & 0 deletions app.less
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
**/

/* avBooth */
@import "avBooth/booth.less";
@import "avBooth/2questions-conditional-screen-directive/2questions-conditional-screen-directive.less";
@import "avBooth/election-chooser-screen-directive/election-chooser-screen-directive.less";
@import "avBooth/booth-header-directive/booth-header-directive.less";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</div>

<span
class="label label-default"
class="label label-default answer-category"
ng-if="showCategory && !!option.category">
{{option.category}}
</span>
Expand Down Expand Up @@ -56,15 +56,15 @@
{{option.selected + 1}}.
</span>
<span>
<span ng-bind-html="option.text"></span>
<span class="answer-text" ng-bind-html="option.text"></span>
<span
ng-if="showPoints && option.selected > -1"
ng-i18next="[i18next]({points: getPoints()})avBooth.showSelectedOptionPoints">
</span>
</span>
</strong>
<p class="details visible-lg" ng-if="(dnd_disable || !selectedOptions || (!!selectedOptions && !isTouchDevice)) && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="details hidden-lg" ng-if="!selectedOptions && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="answer-description details visible-lg" ng-if="(dnd_disable || !selectedOptions || (!!selectedOptions && !isTouchDevice)) && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="answer-description details hidden-lg" ng-if="!selectedOptions && option.details && option.details.length > 1" ng-bind-html="option.details">
</p>
</div>
</div>
Expand All @@ -84,7 +84,7 @@
ng-click="!isPreset && toggleSelectItem(option)">

<span
class="label label-default"
class="label label-default answer-category"
ng-if="showCategory && !!option.category">
{{option.category}}
</span>
Expand Down Expand Up @@ -154,15 +154,15 @@
{{option.selected + 1}}.
</span>
<span>
<span ng-bind-html="option.text"></span>
<span class="answer-text" ng-bind-html="option.text"></span>
<span
ng-if="showPoints && option.selected > -1"
ng-i18next="[i18next]({points: getPoints()})avBooth.showSelectedOptionPoints">
</span>
</span>
</strong>
<p class="details visible-lg" ng-if="(dnd_disable || !selectedOptions || (!!selectedOptions && !isTouchDevice)) && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="details hidden-lg" ng-if="!selectedOptions && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="answer-description details visible-lg" ng-if="(dnd_disable || !selectedOptions || (!!selectedOptions && !isTouchDevice)) && option.details && option.details.length > 1" ng-bind-html="option.details">
<p class="answer-description details hidden-lg" ng-if="!selectedOptions && option.details && option.details.length > 1" ng-bind-html="option.details">
</p>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
clear: both;
overflow: hidden;

.answer-text,
.answer-category,
.answer-description {
word-break: break-all;
}

.opt-data {
display: block;
float: left;
Expand Down
2 changes: 1 addition & 1 deletion avBooth/booth-header-directive/booth-header-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/>
</span>
</div>
<div class="col-xs-6" ng-if="!election.logo_url">
<div class="col-xs-12 col-sm-6" ng-if="!election.logo_url">
<span
class="powered-by"
ng-i18next="[html:i18next]({url: organization.orgUrl, name: organization.orgName})avCommon.poweredBy"
Expand Down
4 changes: 3 additions & 1 deletion avBooth/booth.less
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,6 @@
/* Component LESS */
/* Add Component LESS Above */


button {
white-space: normal !important;
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="navbar-unfixed-top text-center">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-bind-html="parentElection && (parentElection.presentation.extra_options.public_title || parentElection.title) || !parentElection && (election.presentation.extra_options.public_title || election.title) || ''">
<h1 class="election-title" ng-bind-html="parentElection && (parentElection.presentation.extra_options.public_title || parentElection.title) || !parentElection && (election.presentation.extra_options.public_title || election.title) || ''">
</h1>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@
margin: 25px;
font-weight: bold;
}

.election-title,
.election-description {
word-break: break-all;
}
}
11 changes: 8 additions & 3 deletions avBooth/multi-question-directive/multi-question-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
<div class="navbar-unfixed-top text-center">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-if="!showingPreset" ng-bind-html="stateData.question.title"></h1>
<h1
class="question-title"
ng-if="!showingPreset"
ng-bind-html="stateData.question.title"
></h1>
<p
ng-if="!showingPreset"
class="description"
ng-bind-html="stateData.question.description | addTargetBlank"></p>
class="question-description description"
ng-bind-html="stateData.question.description | addTargetBlank"
></p>
</div>
</div>
</div>
Expand Down
14 changes: 13 additions & 1 deletion avBooth/multi-question-directive/multi-question-directive.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@
font-size: 16px;
}

.description {
.question-description {
padding-bottom: 15px;
}

.question-title,
.question-description {
word-break: break-all;
}

.filter-input {
input {
border: 0;
Expand Down Expand Up @@ -103,3 +108,10 @@
color: @av-secondary;
}
}

@media(max-width: @screen-sm-min) {
[avb-simultaneous-questions-screen] .affix-bottom .warnings {
overflow-y: scroll;
max-height: 60px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<!-- title -->
<h3 aria-level="2" class="text-brand-success question-title">
<span>{{$index + 1}}.</span>
<span class="title-text" ng-bind-html="question.title"></span>
<span class="question-title title-text" ng-bind-html="question.title"></span>
<div class="pull-right">
<span class="glyphicon glyphicon-edit" aria-hidden="true"></span>
</div>
Expand Down
6 changes: 6 additions & 0 deletions avBooth/review-ballot-directive/review-ballot-directive.less
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@
padding-top: 20px;
}

.selected-answer,
.question-title,
.question-description {
word-break: break-all;
}

ul, ol {
margin-bottom: 0;
padding-bottom: 10px;
Expand Down
8 changes: 5 additions & 3 deletions avBooth/review-screen-directive/review-screen-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
<div class="navbar-unfixed-top text-center">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-bind-html="election.presentation.extra_options.public_title || election.title">
<h1
class="election-title"
ng-bind-html="election.presentation.extra_options.public_title || election.title">
</h1>
<h1 ng-i18next="avBooth.reviewYourBallotTitle"></h1>
<p ng-i18next="avBooth.reviewYourBallotText"></p>
<h1 class="review-title" ng-i18next="avBooth.reviewYourBallotTitle"></h1>
<p class="review-description" ng-i18next="avBooth.reviewYourBallotText"></p>
</div>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions avBooth/review-screen-directive/review-screen-directive.less
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
padding: 0;
}

.election-title {
word-break: break-all;
}

.locator-text-click-audit {
padding: 10px;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@
.answer-text {
font-size: 18px;
font-weight: bold;
word-break: break-all;
}

.answer-details {
font-size: 14px;
word-break: break-all;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
<div class="content avb-content">
<div class="container">
<div class="col-xs-12 text-center">
<h1 ng-bind-html="election.presentation.extra_options.public_title || election.title">
</h1>
<h1
class="election-title"
ng-bind-html="election.presentation.extra_options.public_title || election.title"
></h1>
<p
ng-if="election.description"
class="election-description"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@
font-size: 24px;
}

.question-title,
.election-title,
.question-description,
.error-list li {
word-break: break-all;
}

.question-answer-wrapper.col-md-12,
.question-answer-wrapper.col-md-6,
.question-answer-wrapper.col-md-4,
Expand All @@ -109,3 +116,10 @@
}
}
}

@media(max-width: @screen-sm-min) {
[avb-simultaneous-questions-screen] [av-affix-bottom] .error-list > ul {
overflow-y: scroll;
max-height: 60px;
}
}
13 changes: 9 additions & 4 deletions avBooth/start-screen-directive/start-screen-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@
<div class="navbar-unfixed-top text-center">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-bind-html="parentElection && (parentElection.presentation.extra_options.public_title || parentElection.title) || !parentElection && (election.presentation.extra_options.public_title || election.title) || ''">
</h1>
<p class="description" ng-bind-html="((parentElection && parentElection.description) || (!parentElection && election.description) || '') | addTargetBlank"></p>
<h1
class="election-title"
ng-bind-html="parentElection && (parentElection.presentation.extra_options.public_title || parentElection.title) || !parentElection && (election.presentation.extra_options.public_title || election.title) || ''"
></h1>
<p
class="election-description description"
ng-bind-html="((parentElection && parentElection.description) || (!parentElection && election.description) || '') | addTargetBlank"
></p>
</div>
</div>
</div>
Expand Down Expand Up @@ -42,7 +47,7 @@ <h4>{{tosTitle}}</h4>
</div>

<div class="row" ng-if="legal">
<div class="padded col-xs-12">
<div class="padded col-xs-12 legal-terms">
<!-- Legal terms -->
<h4 ng-i18next="avBooth.legal.title"></h4>
<span ng-if="extra_data.name" ng-i18next>{{extra_data.name}}, </span>
Expand Down
8 changes: 7 additions & 1 deletion avBooth/start-screen-directive/start-screen-directive.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
padding-bottom: 10px;
}

.description {
.election-description {
padding-bottom: 15px;
}

.election-title,
.election-description,
.legal-terms {
word-break: break-all;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<div class="navbar-unfixed-top text-center" av-collapsing=".unfixed-top-height" data-toggle-selector="[avb-success-screen] #avb-toggle">
<div class="container">
<div class="hidden unfixed-top-height"></div>
<h1 ng-i18next="avBooth.successTitle"></h1>
<p ng-i18next="avBooth.successSubheader"></p>
<h1 class="success-title" ng-i18next="avBooth.successTitle"></h1>
<p class="success-subheader" ng-i18next="avBooth.successSubheader"></p>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
display: block;
}

.success-title,
.success-subheader {
word-break: break-all;
}

.social-net-img {
max-height: 48px;
max-width: 150px;
Expand Down

0 comments on commit e62dc19

Please sign in to comment.