From 68b231dbdbab26c894a85344cc85ba42d69b2d1c Mon Sep 17 00:00:00 2001 From: etiennevvv <59622352+etiennevvv@users.noreply.github.com> Date: Tue, 4 Feb 2020 12:18:10 -0500 Subject: [PATCH] GRN2-266: Autofocus room name when create room modal appears (#945) * added autofocus to the Room Name field * added autofocus to Room Name text field * added autofocus to Room Name text field * GRN2-266 Fixing autofocus for Room name when creating room * removing whitespace * fixing whitespace * fixing whitespace --- app/assets/javascripts/room.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/room.js b/app/assets/javascripts/room.js index 1a80be95..4b762e04 100644 --- a/app/assets/javascripts/room.js +++ b/app/assets/javascripts/room.js @@ -51,6 +51,13 @@ $(document).on('turbolinks:load', function(){ }) } + // Autofocus on the Room Name label when creating a room only + $('#createRoomModal').on('shown.bs.modal', function (){ + if ($(".create-only").css("display") == "block"){ + $('#create-room-name').focus() + } + }) + if (controller == "rooms" && action == "show" || controller == "admins" && action == "server_rooms"){ // Display and update all fields related to creating a room in the createRoomModal $(".update-room").click(function(){