Skip to content

Commit

Permalink
Add validation error border around the datepicker's input.
Browse files Browse the repository at this point in the history
  • Loading branch information
dombesz committed Dec 17, 2024
1 parent 8040262 commit 583a2f3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions frontend/src/global_styles/primer/_overrides.sass
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions lib/primer/open_project/forms/date_picker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class DatePicker < Primer::Forms::TextField

def initialize(input:, datepicker_options:)
super(input:)

@field_wrap_arguments[:invalid] = true if @input.invalid?
@datepicker_options = datepicker_options
end
end
Expand Down

0 comments on commit 583a2f3

Please sign in to comment.