"Save selected text to variable selected_text" copies clipboard content instead of selection or does not work at all

Breaking news regarding this issue: The culprit is apparently not the "Save selected text to variable selected_text" action but the Floating WebView (or the combination of both).

Today I revisited the issue and found this forum post (up until now I thought the Floating WebView was the only action that can access the content of the selected_text variable).

So I tested it with the example javascript snippet that runs a shell script which calls the say command. This works just fine.

So there must be something wrong going on during the transfer of the variable content to the WebView action (maybe a caching problem or something?).

Or maybe I did something wrong? This is what my WebView looks like (I adapted it from the example from this forum):

<html>
<script>
async function BTTInitialize() {
  let selectedText = await callBTT('get_string_variable', {variable_name:'selected_text'})
  var span = document.getElementById("content");
  span.textContent = selectedText;
}
</script>
<body>
<div  style="with:100%; height:100%; display:flex; align-items:center;align-content:center; justify-content:center; background-color:white">
<span id="content" style="font: bold 24px Helvetica">...</span>
</div>
</body>
</html>