diff --git a/app/assets/stylesheets/common/base/discourse.scss b/app/assets/stylesheets/common/base/discourse.scss index 9d17c754915..50158919df3 100644 --- a/app/assets/stylesheets/common/base/discourse.scss +++ b/app/assets/stylesheets/common/base/discourse.scss @@ -245,11 +245,6 @@ input { padding-bottom: 0; } -// Fixes Chrome height inconsistency -::-webkit-calendar-picker-indicator { - height: 100%; -} - ::placeholder { text-overflow: ellipsis; } diff --git a/app/assets/stylesheets/common/components/date-input.scss b/app/assets/stylesheets/common/components/date-input.scss index 29b76e57410..c68fb468fcc 100644 --- a/app/assets/stylesheets/common/components/date-input.scss +++ b/app/assets/stylesheets/common/components/date-input.scss @@ -1,3 +1,5 @@ +$calendar-icon: ''; + .d-date-input { display: inline-flex; cursor: pointer; @@ -10,20 +12,13 @@ margin: 0; text-align: left; width: 100%; - box-shadow: none !important; - - &::-webkit-input-placeholder { - font-size: $font-0; - color: var(--primary-medium); - } - - &::-ms-input-placeholder { - font-size: $font-0; - color: var(--primary-medium); - } + box-shadow: none; + position: relative; + &::-webkit-input-placeholder, + &::-ms-input-placeholder, &::placeholder { - font-size: $font-0; + font-size: var(--font-0); color: var(--primary-medium); } @@ -32,12 +27,42 @@ } // iOS doesn't display the placeholder attribute for date inputs - .ios-device &:after { + html.ios-device &:after { font-size: var(--font-0); color: var(--primary-medium); content: attr(placeholder); } + + // use custom icon and fix issues across browsers + // - Safari does not use an icon + // - default Chrome/IE icon too tall, makes input height inconsistent + // - default Chrome/IE icon are black on dark themes + // - allows themes to style as needed + // Note that this does nothing in Firefox + html:not(.ios-device) & { + &::after { + content: ""; + -webkit-mask: svg-uri($calendar-icon) no-repeat 50% 50%; + mask: svg-uri($calendar-icon) no-repeat 50% 50%; + position: absolute; + right: 4px; + top: 0px; + box-sizing: border-box; + background-color: var(--primary); + height: 100%; + width: 20px; + z-index: 1; + } + &::-webkit-calendar-picker-indicator { + background: transparent; + position: absolute; + cursor: pointer; + right: 0px; + z-index: 2; + } + } } + .pika-single { margin-left: -1px; margin-top: 1px;