-
Notifications
You must be signed in to change notification settings - Fork 200
feat: add smooth glow/border animation on Input focus #1747
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
63875d3
f956c1b
dfc47d0
660400a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -267,6 +267,12 @@ export class PasswordInput extends Widget { | |||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| protected _renderSelf(screen: Screen): void { | ||||||||||||||||||||
| // Apply glow effect on focus by changing border style | ||||||||||||||||||||
| if (this.isFocused) { | ||||||||||||||||||||
| this._style.border = 'single'; | ||||||||||||||||||||
| } else { | ||||||||||||||||||||
|
|
||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+270
to
+275
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Blur path discards configured The unfocused branch resets Proposed fix protected _renderSelf(screen: Screen): void {
- // Apply glow effect on focus by changing border style
- if (this.isFocused) {
- this._style.borderFg = 'cyan';
- } else {
- this._style.borderFg = undefined;
- }
+ const baseBorderFg = this.style.borderFg;
+ this._style.borderFg = this.isFocused ? 'cyan' : baseBorderFg;
const rect = this._getContentRect();📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| const rect = this._getContentRect(); | ||||||||||||||||||||
| const { x, y, width, height } = rect; | ||||||||||||||||||||
| if (width <= 0 || height <= 0) return; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -209,6 +209,12 @@ export class PathInput extends Widget { | |
| } | ||
|
|
||
| protected _renderSelf(screen: Screen): void { | ||
| // Apply glow effect on focus by changing border style | ||
| if (this.isFocused) { | ||
| this._style.border = 'single'; | ||
| } else { | ||
|
|
||
| } | ||
|
Comment on lines
+212
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Focus glow logic is not style-safe Clearing Proposed fix protected _renderSelf(screen: Screen): void {
- // Apply glow effect on focus by changing border style
- if (this.isFocused) {
- this._style.borderFg = 'cyan';
- } else {
- this._style.borderFg = undefined;
- }
+ const baseBorderFg = this.style.borderFg;
+ this._style.borderFg = this.isFocused ? 'cyan' : baseBorderFg;
const rect = this._getContentRect();🤖 Prompt for AI Agents |
||
| const rect = this._getContentRect(); | ||
| const { x, y, width, height } = rect; | ||
| if (width <= 0 || height <= 0) return; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,12 @@ export class TextArea extends Widget { | |
| } | ||
|
|
||
| protected _renderSelf(screen: Screen): void { | ||
| // Apply glow effect on focus by changing border style | ||
| if (this.isFocused) { | ||
| this._style.border = 'single'; | ||
| } else { | ||
|
|
||
| } | ||
|
Comment on lines
+161
to
+166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Border glow implementation overrides base styling The blur path resets border color to Proposed fix protected _renderSelf(screen: Screen): void {
- // Apply glow effect on focus by changing border style
- if (this.isFocused) {
- this._style.borderFg = 'cyan';
- } else {
- this._style.borderFg = undefined;
- }
+ const baseBorderFg = this.style.borderFg;
+ this._style.borderFg = this.isFocused ? 'cyan' : baseBorderFg;
const rect = this._getContentRect();🤖 Prompt for AI Agents |
||
| const rect = this._getContentRect(); | ||
| const { x, y, width, height } = rect; | ||
| if (width <= 0 || height <= 0) return; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Focused glow currently wipes custom border color after blur
When focus is lost, setting
this._style.borderFg = undefinedpermanently drops any caller-provided border color, so the component does not return to its configured style.Proposed fix
protected _renderSelf(screen: Screen): void { - // Apply glow effect on focus by changing border style - if (this.isFocused) { - this._style.borderFg = 'cyan'; - } else { - this._style.borderFg = undefined; - } + const baseBorderFg = this.style.borderFg; + this._style.borderFg = this.isFocused ? 'cyan' : baseBorderFg; const rect = this._getContentRect();📝 Committable suggestion
🤖 Prompt for AI Agents