Skip to content
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

feat(editable-title): move cursor and scroll to the end #15270

Merged
merged 1 commit into from
Jun 23, 2021

Conversation

stephenLYZ
Copy link
Member

SUMMARY

This PR improves the UX of editable title component. Move the cursor and scroll to the end when focusing, for easier delete.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

before

Screen.Recording.2021-06-11.at.6.09.02.PM.mov

after

2021-06-19.7.09.10.mov

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

@codecov
Copy link

codecov bot commented Jun 19, 2021

Codecov Report

Merging #15270 (3c7b184) into master (745b577) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #15270   +/-   ##
=======================================
  Coverage   77.26%   77.26%           
=======================================
  Files         971      971           
  Lines       50308    50313    +5     
  Branches     6140     6141    +1     
=======================================
+ Hits        38869    38874    +5     
  Misses      11235    11235           
  Partials      204      204           
Flag Coverage Δ
javascript 71.81% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...et-frontend/src/components/EditableTitle/index.tsx 84.88% <100.00%> (+0.93%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 745b577...3c7b184. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the fix!

const { length } = contentRef.current.value;
contentRef.current.setSelectionRange(length, length);
contentRef.current.scrollLeft = contentRef.current.scrollWidth;
contentRef.current.scrollTop = contentRef.current.scrollHeight;
Copy link
Member

@villebro villebro Jun 23, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is needed (setting scrollTop), but it probably doesn't hurt, either

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Here I think it need to scroll to the bottom for the textarea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Here I think it need to scroll to the bottom for the textarea.

Right you are! 👍

@villebro villebro merged commit f31d573 into apache:master Jun 23, 2021
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants