Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

WP Fields [4]: Two columns with label-on-top on mobile only for long text fields (#12588)

Yule7c4ed40876be
diff --git a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass
index 2e7ec1840ad..8f1df7192e8 100644
--- a/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass
+++ b/frontend/src/app/features/work-packages/components/wp-form-group/wp-attribute-group.component.sass
@@ -13,14 +13,14 @@
width: calc(100% + #{$spot-spacing-3})
&--attribute
- flex-basis: calc(100% - #{$spot-spacing-3})
- flex-grow: 0
- flex-shrink: 0
+ flex-basis: 400px
+ flex-grow: 1
+ flex-shrink: 1
+ min-width: calc(50% - #{$spot-spacing-3})
+ max-width: calc(100% - #{$spot-spacing-3})
margin: 0 $spot-spacing-1_5
- @media screen and (min-width: 92rem), print
- flex-basis: calc(50% - #{$spot-spacing-3})
- min-width: 25rem
-
&_span-all
flex-basis: calc(100% - #{$spot-spacing-3})
+ flex-shrink: 0
+ flex-wrap: wrap
diff --git a/frontend/src/global_styles/content/_attributes_key_value.sass b/frontend/src/global_styles/content/_attributes_key_value.sass
index 7d7083bff70..abab2964ca7 100644
--- a/frontend/src/global_styles/content/_attributes_key_value.sass
+++ b/frontend/src/global_styles/content/_attributes_key_value.sass
@@ -28,54 +28,57 @@
.attributes-key-value
display: flex
- flex-wrap: wrap
+ // flex-wrap: wrap
font-size: 0.875rem
-
-.attributes-key-value--key
- @extend .form--label
- display: flex
- flex: 1 0 35%
- max-width: 35%
margin-bottom: 0.1875rem
- padding: 0.375rem 0
- font-weight: bold
- // Ensure that the text is shortened while the help icon will be displayed
- // The flex and max-width of wp-replacement-label and attribute-help-text
- // are tuned to:
- // * have the label be displayed in total if there is enough place (safari
- // tends to sometimes fall back to ellipsis too early, e.g. for 'Category')
- // * Have the label grow to the full width if necessary and only apply ellipsis
- // after that.
- // * have the attribute-help-text positioned as far to the left as possible so to be
- // right after the label.
- // It is unclear why in `flex: 100 0 auto` the 100 seems to be doing the trick (MAGIC NUMBER).
- // It does not work with e.g. 1000 or 10
- > wp-replacement-label
- @include text-shortener
- padding-right: $spot-spacing-0_5
- flex: 1 1 auto
- max-width: 100%
- > attribute-help-text
- flex: 100 0 auto
-.attributes-key-value--value-container
- display: flex
- flex: 1 0 65%
- max-width: 65%
- margin-bottom: 0.1875rem
- padding: 0.375rem 0
- align-self: center
- height: 100%
+ &--key
+ @extend .form--label
+ display: flex
+ flex-basis: 140px
+ flex-grow: 1
+ padding: 0.375rem 0
+ font-weight: bold
+ overflow-wrap: break-word
+ hyphens: auto
- p
- font-size: $form-label-fontsize
- word-wrap: break-word
+ > wp-replacement-label
+ padding-right: $spot-spacing-0_5
+ flex: 1 1 auto
+ max-width: 100%
- &.not-editable
- padding: 6px
+ > attribute-help-text
+ flex: 100 0 auto
-.attributes-key-value--value
- @include grid-visible-overflow
+ &--value-container
+ display: flex
+ flex-basis: 260px
+ flex-grow: 1000000
+ flex-shrink: 1
+ align-self: center
+ margin-bottom: 0.1875rem
+ padding: 0.375rem 0
+ height: 100%
+
+ p
+ font-size: $form-label-fontsize
+ word-wrap: break-word
+
+ &.not-editable
+ padding: 6px
+
+ &--value
+ @include grid-visible-overflow
+
+ @at-root &.wp-attribute-group--attribute_span-all &--value-container
+ flex-shrink: 0
+ // This is a magic number that was obtained by trial and error
+ // The goal is to have span-all containers move to label-on-top
+ // right as the layout goes from 2-column to 1-column.
+ // There problably is some calculation by which you can derive this,
+ // but I'm currently too lazy to figure it out
+ flex-basis: 708px
+ max-width: 100%
// Alternative implementation to the one above.
// It's main advantage is that it can act on the whole of the key/value-pairs.
diff --git a/frontend/src/global_styles/content/_forms_mobile.sass b/frontend/src/global_styles/content/_forms_mobile.sass
index a7635b8b3c4..232c007aebc 100644
--- a/frontend/src/global_styles/content/_forms_mobile.sass
+++ b/frontend/src/global_styles/content/_forms_mobile.sass
@@ -50,19 +50,20 @@
max-width: 100%
#tab-content-info form,
- .form--label,
- .form--field-container
- flex-basis: 100% !important
- max-width: 100% !important
+ .form--label,
+ .form--field-container
+ flex-basis: 100%
+ max-width: 100%
autocomplete-select-decoration
width: 100%
- .form--field-inline-buttons-container
- .form--field-inline-button
- width: auto !important
+ .form--field-inline-buttons-container,
+ .form--field-inline-button
+ width: auto
- .-browser-safari, .-browser-chrome
+ .-browser-safari,
+ .-browser-chrome
// Special rule for mobile safari and chrome to prevent zooming into the text field
// when focused.
select,
diff --git a/frontend/src/global_styles/content/work_packages/single_view/_single_view.sass b/frontend/src/global_styles/content/work_packages/single_view/_single_view.sass
index d2ae70ed818..1d99d80e7bb 100644
--- a/frontend/src/global_styles/content/work_packages/single_view/_single_view.sass
+++ b/frontend/src/global_styles/content/work_packages/single_view/_single_view.sass
@@ -115,34 +115,6 @@ i
padding: 0
margin: 0
-// Increase label width
-.router--work-packages-full-view .attributes-group,
-.router--work-packages-full-create .attributes-group
- // We have to find a middle way between
- // (a) avoiding label wrap and
- // (b) ugly content wrap (e.g. in the label)
- // These values are what matches best at the moment. So be careful when changing them.
- .attributes-key-value--key
- flex: 1 0 45%
- max-width: 45%
- .attributes-key-value--value-container
- position: relative
- flex: 1 0 55%
- max-width: 55%
-
- // For attributes that span both columns, make sure the label is not way too wide
- .wp-attribute-group--attribute_span-all
- @media screen and (min-width: 92rem), print
- // These weird calculations are made to account for the side-margins that make
- // up the flex-basis calculations of the single-column items.
- .attributes-key-value--key
- flex: 1 0 calc((100% - 3rem) * 0.225)
- max-width: calc((100% - 3rem) * 0.225)
- .attributes-key-value--value-container
- flex: 1 0 calc((100% - 3rem) * 0.775)
- max-width: calc((100% - 3rem) * 0.775)
-
-
// -------------------- Info row --------------------
.work-packages--info-row
font-size: 12px
diff --git a/frontend/src/global_styles/layout/work_packages/_mobile.sass b/frontend/src/global_styles/layout/work_packages/_mobile.sass
index 0195c2f8642..8b70e8dc5b1 100644
--- a/frontend/src/global_styles/layout/work_packages/_mobile.sass
+++ b/frontend/src/global_styles/layout/work_packages/_mobile.sass
@@ -76,17 +76,9 @@
.toolbar-container
padding-right: 0
- .attributes-key-value--key,
- .attributes-key-value--value-container
- margin-bottom: 20px
-
.inplace-editing--container
border: none
- .attributes-key-value--key
- flex-basis: 30% !important
- padding: 0 !important
-
.work-packages--panel-inner > .attributes-group:first-child
.attributes-group--header
border-bottom: none