-
Notifications
You must be signed in to change notification settings - Fork 14k
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
fix: incorrect cursor position Firefox #12423
fix: incorrect cursor position Firefox #12423
Conversation
cc: @eschutho |
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.
can you verify that this still works as expected in chrome and safari? We've fixed this same bug a number of times in various browsers.
@@ -208,6 +208,10 @@ div.Workspace { | |||
.ace_content { | |||
height: 100%; | |||
} | |||
|
|||
.ace_editor * { | |||
font: inherit!important; |
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.
ugh, !important
🤮 I guess if this is the only way to fix it then it's ok
Although, do we need to apply this to all elements that are descendants of .ace_editor
or can we be more specific here? Also, could you add a space between inherit and !important?
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.
It seems that the issue is around the bolded typeface in Fira Code, with the same issue with Inter and monospace. The only one I was able to get to work was "Courier New" so far. Targeting just the bold text seems to work (nested under .ace_editor.ace_editor) if you don't want to change everything:
.ace_keyword {
font-family: 'Courier New';
}
we could try out a few different common system fonts if you want to try to find a sans serif.
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.
"Menlo" works and is sans serif, but for Mac only if you want to add that and fall back to Courier.
Codecov Report
@@ Coverage Diff @@
## master #12423 +/- ##
==========================================
- Coverage 66.12% 63.15% -2.98%
==========================================
Files 1015 486 -529
Lines 49554 29956 -19598
Branches 5079 0 -5079
==========================================
- Hits 32767 18918 -13849
+ Misses 16647 11038 -5609
+ Partials 140 0 -140
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
51fe19a
to
752dcb7
Compare
752dcb7
to
fcf009e
Compare
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.
stamping, could you also file an issue for the Safari UX bug?
Finally, does this need to be changed in other places where we use the code editor as well? Dataset edit modal, adhoc metric popover, etc.?
@@ -378,7 +378,9 @@ div.tablePopover { | |||
//double class is better than !important | |||
border: 1px solid @gray-light; | |||
font-feature-settings: @font-feature-settings; | |||
font-family: @font-family-monospace; | |||
// Fire Code causes problem with Ace under Firefox |
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.
sp nit, i think it's Fira Code
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.
Thanks!
font-family: @font-family-monospace; | ||
// Fire Code causes problem with Ace under Firefox | ||
font-family: 'Menlo', 'Courier New', 'Ubuntu Mono', 'Consolas', | ||
'source-code-pro', monospace; |
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.
Two small things..We could target just the bold typeface by using the selector .ace_editor.ace_editor .ace_keyword
if we wanted to just change the bold typeface. Also talking with @Steejay can we try 'Lucida Console' instead of 'Courier New'? Here's the comparison for reference:
Ugh... not again! ACE Editor is so painful with this issue, it seems to keep popping up like whack-a-mole. My general feelings on the issue are:
The way it calculates the position is just super error prone... I'm not sure if something like CodeMirror has all the features we need, but my temptation to dive into that rabbit hole is growing. |
@ktmud mentioned using the code editor that vscode uses a while back (https://github.com/microsoft/monaco-editor). If after 1.0.0 anyone wanted to do some tech debt cleanup/refactor, moving to Monaco editor might be reasonable Edit: and here's a react wrapper: https://github.com/suren-atoyan/monaco-react |
Nice, we'll look into those options. Thanks @etr2460 and @rusackas for the feedback. |
I think keeping the font consistent would be ideal especially if its within the same line. |
|
* fix: incorrect cursor position Firefox * Use different font * Fix lint * Use Lucida Console
SUMMARY
When using SQL Lab in Firefox, the position of the cursor will drift to the left progressively along the row. As the cursor moves to the right, it's shifted more and more to the left, to a point where it shows up in the incorrect position.
This seems to be a known bug: https://stackoverflow.com/questions/20931029/ace-editor-monospace-fonts-issues-with-cursor-spacing
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Here's a query in Firefox, with the cursor moved to the end of the line:
Note how it looks like the cursor is to the left of the semi-colon — it's not, and if the user presses delete the semi-colon will be deleted instead!
Here's the same query with this fix:
TEST PLAN
ADDITIONAL INFORMATION