当前位置:网站首页>The textarea cursor cannot be controlled by the keyboard due to antd dropdown + modal + textarea
The textarea cursor cannot be controlled by the keyboard due to antd dropdown + modal + textarea
2022-04-23 19:40:00 【Mediocre °】
problem
Let's talk about the demand scenario where the problem occurs , You need to click to display a drop-down box , Different drop-down boxes correspond to different Modal Components , Including displaying account information , Ban / Enable the account number and fill in the reason and other requirements . Is to use the Dropdown Components +Modal+Input.Textarea Components to do , After finishing, I found a little bug. Click the up, down, left and right buttons in the text field , The cursor does not move with .
terms of settlement
After investigation , Find out Dropdown If you click to select MenuItem after , Do not retract it , Will find , After entering text in the text field , If you click the up and down buttons , The cursor does not move , however MenuItem The selection will move with the keyboard event . This explanation MenuItem perhaps Menu There is also monitoring for keyboard events . It should be something done here that causes the movement of the text field cursor to fail , So what's the solution , Finally found in the text field or MenuItem binding onKeyDown Event in which to prevent event bubbling e.stopPropagation(); , There will be no impact .
Then I tried , The problem is not dropdown Caused by the , It is Menu, Even if we use it alone Menu Component to implement and Modal+ Similar problems occur in text fields . Stop the event from bubbling to solve .
Cause analysis of the problem

I guess the reason for this problem is , Keyboard event after modifying the cursor in the text field , Bubble to Menu in , Click the up, down, left and right keys , Mobile MenuItem The selection effect of , The focus moves from the text field to MenuItem in , Will appear , The problem that the up, down, left and right keys can't control the cursor .
版权声明
本文为[Mediocre °]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231929196084.html
边栏推荐
- MySQL数据库 - 单表查询(三)
- Thoughts on the optimization of examination papers in the examination system
- goroutine
- @Analysis of conditional on Web Application
- [report] Microsoft: application of deep learning methods in speech enhancement
- 图书管理数据库系统设计
- MFCC: Mel频率倒谱系数计算感知频率和实际频率转换
- Summary of several relationships of UML class diagram
- Codeforces Round #783 (Div. 2) D题解
- Executor、ExecutorService、Executors、ThreadPoolExecutor、Future、Runnable、Callable
猜你喜欢

【webrtc】Add x264 encoder for CEF/Chromium

MySQL syntax collation (2)

MySQL syntax collation (3)

No, some people can't do the National Day avatar applet (you can open the traffic master and earn pocket money)

山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(七)

MySQL syntax collation (4)

Zero base to build profit taking away CPS platform official account

Shanda Wangan shooting range experimental platform project - personal record (V)

Common SQL commands

JVM的类加载过程
随机推荐
【webrtc】Add x264 encoder for CEF/Chromium
Kubernetes入门到精通-KtConnect(全称Kubernetes Toolkit Connect)是一款基于Kubernetes环境用于提高本地测试联调效率的小工具。
Virtual machine performance monitoring and fault handling tools
MySQL数据库 - 单表查询(二)
PostgreSQL
山东大学软件学院项目实训-创新实训-网络安全靶场实验平台(六)
Physical meaning of FFT: 1024 point FFT is 1024 real numbers. The actual input to FFT is 1024 complex numbers (imaginary part is 0), and the output is also 1024 complex numbers. The effective data is
基于pytorch搭建GoogleNet神经网络用于花类识别
Data analysis learning directory
TI DSP的 FFT与IFFT库函数的使用测试
kibana 报错 server is not ready yet 可能的原因
Go three ways to copy files
Common SQL commands
视频理解-Video Understanding
UML类图几种关系的总结
Why is PostgreSQL about to surpass SQL Server?
Audio signal processing and coding - 2.5.3 the discrete cosine transform
@MapperScan与@Mapper
Unity创建超写实三维场景的一般步骤
[report] Microsoft: application of deep learning methods in speech enhancement