Browse Source

Fix input field label selector

Fix clearing input by selection in new media popup
master
Eduard Kuzmenko 4 years ago
parent
commit
f387ef8a27
  1. 2
      src/components/popups/newMedia.ts
  2. 1
      src/lib/appManagers/appMessagesManager.ts
  3. 10
      src/scss/partials/_input.scss
  4. 2
      src/scss/partials/popups/_mediaAttacher.scss

2
src/components/popups/newMedia.ts

@ -110,7 +110,7 @@ export default class PopupNewMedia extends PopupElement {
private onKeyDown = (e: KeyboardEvent) => { private onKeyDown = (e: KeyboardEvent) => {
const target = e.target as HTMLElement; const target = e.target as HTMLElement;
if(target.tagName != 'INPUT') { if(target !== this.input) {
this.input.focus(); this.input.focus();
placeCaretAtEnd(this.input); placeCaretAtEnd(this.input);
} }

1
src/lib/appManagers/appMessagesManager.ts

@ -248,6 +248,7 @@ export class AppMessagesManager {
if(removeUnread && dialog.unread_count) dialog.unread_count -= removeUnread; if(removeUnread && dialog.unread_count) dialog.unread_count -= removeUnread;
dialog.unread_count = Math.max(0, dialog.unread_count);
dialogs.push(dialog); dialogs.push(dialog);
appStateManager.setPeer(dialog.peerId, appPeersManager.getPeer(dialog.peerId)); appStateManager.setPeer(dialog.peerId, appPeersManager.getPeer(dialog.peerId));

10
src/scss/partials/_input.scss

@ -95,7 +95,7 @@
&.error { &.error {
border-color: $color-error; border-color: $color-error;
& + label { & ~ label {
color: $color-error!important; color: $color-error!important;
} }
} }
@ -103,7 +103,7 @@
&.valid { &.valid {
border-color: #26962F; border-color: #26962F;
& + label { & ~ label {
color: #26962F !important; color: #26962F !important;
} }
} }
@ -119,11 +119,11 @@
border-color: $button-primary-background; border-color: $button-primary-background;
} }
&:focus + label { &:focus ~ label {
color: $button-primary-background; color: $button-primary-background;
} }
&:focus + label, &:valid + label, &:not(:empty) + label, &:disabled + label { &:focus ~ label, &:valid ~ label, &:not(:empty) ~ label, &:disabled ~ label {
top: -.5rem; top: -.5rem;
transform: none; transform: none;
padding: 0 5px; padding: 0 5px;
@ -217,7 +217,7 @@ input:focus, button:focus {
background-color: transparent; background-color: transparent;
border-color: $button-primary-background; border-color: $button-primary-background;
& + .tgico { & ~ .tgico {
color: $button-primary-background; color: $button-primary-background;
opacity: 1; opacity: 1;
} }

2
src/scss/partials/popups/_mediaAttacher.scss

@ -141,7 +141,7 @@
font-size: 1rem; font-size: 1rem;
border-radius: $border-radius-medium; border-radius: $border-radius-medium;
&:not(:focus):empty + label { &:not(:focus):empty ~ label {
opacity: 0; opacity: 0;
} }
} }

Loading…
Cancel
Save