Skip to content

Commit

Permalink
TW-1545: Add adr for this ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
nqhhdev authored and hoangdat committed Mar 13, 2024
1 parent e5a14c2 commit 9bfa003
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions docs/adr/0020-keyboard-is-disappeared-then-appeared.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# 20. Keyboard is disappeared then appeared if we send message in a chat which found from search

Date: 2024-03-12

## Status

Accepted

- Issue: [#1545](https://github.com/linagora/twake-on-matrix/issues/1545)

## Context

- In TextField use onTapOutside to hide the keyboard but don't know exactly which screen the keyboard is enabled on.
Therefore, when opening the keyboard on screen A and then switching to screen B, TextField A is still listening onTapOutside.
So Keyboard is disappeared then appears

## Decision
- Check exactly screen the keyboard is enabled in `dismissKeyboard` function.

```dart
void dismissKeyboard(BuildContext context) {
if (ModalRoute.of(context)?.isCurrent == true) {
if (FocusManager.instance.primaryFocus?.hasFocus == true) {
FocusManager.instance.primaryFocus?.unfocus();
}
}
}
```

## Consequences

- The keyboard will not disappear and then reappear when switching screens.

0 comments on commit 9bfa003

Please sign in to comment.