Feb 20 2023 07:14 AM
Hi,
This seems like it should be a simple task but it's not working...we would like to automatically set focus to a control when a Teams app (personal) tab is selected. Simple enough in JS or via the autofocus attribute and works fine either way via Teams in Chrome.
However in the Windows Teams app the focus doesn't happen...it seems like it will only work once the user has manually clicked somewhere within the tab.
Is this expected behaviour? Is there any way to automatically set control focus when a tab is opened?
Cheers,
Steve
Feb 20 2023 09:49 PM - edited Feb 20 2023 10:18 PM
@SteveWBYG - Thanks for reporting your issue. Could you please share screen recording of the issue for both Teams client to get more clarity?
Feb 21 2023 05:13 AM
Thanks @Nivedipa-MSFT. I don't know what help a screen recording would be - I have uploaded an image of my test tab not focusing(!) The code for this page is as follows:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Focus Test</title>
</head>
<body>
<form>
<p>Testing focus...</p>
<input type="text" id="textBox" />
</form>
<script>
document.getElementById("textBox").focus();
</script>
</body>
</html>
If I view this content via a Teams personal app tab in Chrome it works as expected - the focus is automatically set to the text control when the app/tab is selected and I can type straight into it.
In the Teams Windows desktop app it does NOT work - the focus is not set and I have to manually click into the text box to enter text. This is an extra unwanted step for the user.
I hope you can help - I would be happy to provide any further information you need, or test anything reasonable that you could recommend. Thanks!
Feb 21 2023 11:24 PM - edited Feb 21 2023 11:36 PM
@SteveWBYG - Thanks for the details. We have tested this on Teams Desktop Client version 1.6.00.4378. We are able to repro your issue. We have raised a bug for the same. We will let you know once we get any updates on it. Thanks.
Mar 21 2023 09:46 PM
SolutionMar 22 2023 10:12 AM