The previous position of the Input's cursor is maintained when a setValue call is followed by a setFocus call, even when the input is empty.
Minimal Working Example
--Basalt configurated installer
local filePath = "/basalt.lua" --here you can change the file path default: basalt
if not(fs.exists(filePath))then
shell.run("pastebin run ESs1mg7P packed true "..filePath:gsub(".lua", "")) -- this is an alternative to the wget command
end
local basalt = require(filePath:gsub(".lua", ""))
local main = basalt.createFrame("mainFrame")
local input = main:addInput('input')
:setPosition(1, 1)
:setSize(20, 1)
:setValue('Some Text')
local button = main:addButton('button')
:setPosition(1, 2)
:setSize(20, 1)
:setValue('Button')
:onClickUp(function()
-- Important part
input:setValue('')
input:setFocus()
end)
basalt.autoUpdate()
Describe the bug
The previous position of the
Input
's cursor is maintained when asetValue
call is followed by asetFocus
call, even when the input is empty.Minimal Working Example
https://user-images.githubusercontent.com/43142209/196984044-1d5109b7-6ca2-4bff-bf01-b1cfcb68fbf4.mp4
Steps to reproduce the behavior:
Input
input:setValue('')
input:setFocus()
Expected behavior
The cursor would return to the rightmost side of the input.
Checklist
[x] I am running the latest version.