# Клавиша Escape при вводе в чате: убрать фокус с поля ввода вместо закрытия чата?

**URL:** https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312
**Category:** Feature
**Tags:** chat, completed
**Created:** [26.Май.2023 11:48:16 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312 "2023-05-26T11:48:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [26.Май.2023 11:48:16 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312/1 "2023-05-26T11:48:16Z")

</div>

Я писал или редактировал сообщение в чате.

Я хотел переключиться на что-то другое и, не задумываясь, нажал Escape, ожидая, что это уберет фокус с поля ввода.  
Вместо этого чат закрылся, и я даже не вспомнил, в каком личном чате или канале я писал или редактировал сообщение.

Предлагаю, чтобы нажатие esc просто убирало фокус с поля ввода, а чат закрывался только если поле ввода не в фокусе или пустое.

* * *

Если открыть редактор сообщений, то при нажатии esc, когда содержимое пустое, редактор **закрывается**.  
Если же нажать esc при наличии текста, редактор **сворачивается** , оставаясь заметным и доступным для продолжения написания.

Возможно, стоит реализовать похожее поведение и в чате?

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [26.Май.2023 12:17:20 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312/2 "2023-05-26T12:17:20Z")

</div>

Со мной тоже такое произошло пару дней назад. Я переключился на рабочий стол, но не ожидал, что чат закроется.

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [26.Май.2023 12:18:49 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312/3 "2023-05-26T12:18:49Z")

</div>

Я посмотрю 👍

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [26.Май.2023 16:49:07 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312/5 "2023-05-26T16:49:07Z")

</div>

На этом всё.

> <https://github.com/discourse/discourse/pull/21772>
>
> The current behavior is to close drawer when pressing escape inside the input.
> …
> After this change, first escape will blur the input, and second escape will close the drawer.
> 
> This commit also refactors the whole shortcuts for drawer system spec.

Спасибо 👍

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [26.Май.2023 17:19:04 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312/6 "2023-05-26T17:19:04Z")

</div>

Быстро и эффективно, как и подобает всем котам в галстуках и с ошейниками. 👏

> **реальное фото Джоффри за работой**
>
> ![image](https://global.discourse-cdn.com/meta/original/4X/a/6/3/a6365bd7046b9213be0d8f1ecda2f2dbe7742bd4.jpeg)  
> _Midjourney, что ещё?_

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [28.Май.2023 17:20:04 UTC](https://meta.discourse.org/t/escape-key-when-writing-on-the-chat-unfocus-the-input-instead-of-closing-the-chat/266312/7 "2023-05-28T17:20:04Z")

</div>

Эта тема была автоматически закрыта через 2 дня после последнего ответа. Новые ответы больше не принимаются.
