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

Add validation error border around the datepicker's input.

Dombi Attila583a2f3c842c
diff --git a/frontend/src/global_styles/primer/_overrides.sass b/frontend/src/global_styles/primer/_overrides.sass
index 2ef53fc4dd5..b458b00a2e9 100644
--- a/frontend/src/global_styles/primer/_overrides.sass
+++ b/frontend/src/global_styles/primer/_overrides.sass
@@ -32,6 +32,12 @@
input
border-radius: var(--borderRadius-medium)
+ // Currently we cannot morph the angular datepicker input field, and we have no way to set the
+ // validation error border on the input. However we can morph the input's wrapper element, thus
+ // adding this parent wrapper rule we can display the red border on the input.
+ &-input-wrap[invalid='true'] input:not(:focus)
+ border-color: var(--control-borderColor-danger)
+
.UnderlineNav
@include no-visible-scroll-bar
margin-bottom: 12px
diff --git a/lib/primer/open_project/forms/date_picker.rb b/lib/primer/open_project/forms/date_picker.rb
index f1683489204..f3089f101f7 100644
--- a/lib/primer/open_project/forms/date_picker.rb
+++ b/lib/primer/open_project/forms/date_picker.rb
@@ -9,6 +9,8 @@ module Primer
def initialize(input:, datepicker_options:)
super(input:)
+
+ @field_wrap_arguments[:invalid] = true if @input.invalid?
@datepicker_options = datepicker_options
end
end