You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/06/23 05:00:47 UTC

[GitHub] [superset] villebro commented on a change in pull request #15270: feat(editable-title): move cursor and scroll to the end

villebro commented on a change in pull request #15270:
URL: https://github.com/apache/superset/pull/15270#discussion_r656760254



##########
File path: superset-frontend/src/components/EditableTitle/index.tsx
##########
@@ -70,6 +70,13 @@ export default function EditableTitle({
   useEffect(() => {
     if (isEditing) {
       contentRef.current.focus();
+      // move cursor and scroll to the end
+      if (contentRef.current.setSelectionRange) {
+        const { length } = contentRef.current.value;
+        contentRef.current.setSelectionRange(length, length);
+        contentRef.current.scrollLeft = contentRef.current.scrollWidth;
+        contentRef.current.scrollTop = contentRef.current.scrollHeight;

Review comment:
       Not sure if this is needed, but it probably doesn't hurt, either




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org