Make cmdinput prompt smaller, properly handle select events to take priority over onclick (#558)

This commit is contained in:
Evan Simkowitz 2024-04-08 13:15:33 -07:00 committed by GitHub
parent 37e56acf63
commit af7cc866d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 2 deletions

View File

@ -49,6 +49,7 @@
.base-cmdinput {
position: relative;
cursor: text;
// Rather than apply the padding to the whole container, we will apply it to the inner contents directly.
// This is more fragile, but allows us to capture a larger target area for the individual components.
--padding-top: var(--termpad);

View File

@ -62,7 +62,7 @@ class CmdInput extends React.Component<{}, {}> {
}
@boundMethod
baseCmdInputClick(e: React.MouseEvent): void {
baseCmdInputClick(e: React.SyntheticEvent): void {
if (this.promptRef.current != null) {
if (this.promptRef.current.contains(e.target)) {
return;
@ -231,7 +231,12 @@ class CmdInput extends React.Component<{}, {}> {
</Button>
</div>
</If>
<div key="base-cmdinput" className="base-cmdinput" onClick={this.baseCmdInputClick}>
<div
key="base-cmdinput"
className="base-cmdinput"
onClick={this.baseCmdInputClick}
onSelect={this.baseCmdInputClick}
>
<div className="cmdinput-actions">
<If condition={numRunningLines > 0}>
<div