Skip to content

create component webView ignores layout considerations #1156

@samreid

Description

@samreid

In phetsims/projectile-data-lab#233 (comment) @matthew-blackman and I wanted to create a web view programatically. We did so in a self-contained minimal reproducible example based on the NewRandomNumbers exemplar:

https://github.com/concord-consortium/codap-data-interactives/blob/master/NewRandomNumbers/random-numbers.js

We applied this patch:

Details
Subject: [PATCH] Simplify the background gradient, and make it non-scaled, see https://github.com/phetsims/projectile-data-lab/issues/178
---
Index: NewRandomNumbers/random-numbers.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/NewRandomNumbers/random-numbers.js b/NewRandomNumbers/random-numbers.js
--- a/NewRandomNumbers/random-numbers.js	(revision 8a3a465487d89969b0269e317a92cb18d0a46fc8)
+++ b/NewRandomNumbers/random-numbers.js	(date 1710256056733)
@@ -224,3 +224,11 @@
   // handle errors
   console.log(msg);
 });
+
+setTimeout(()=>{
+  codapInterface.sendRequest({
+    action: 'create', resource: 'component', values: {
+      type: 'webView', name: 'projectileDataWebView', title: 'Data to Collect', URL: 'https://www.google.com'
+    }
+  });
+},5000)

And we observed that the created webView appears behind the data interactive, like so:

image

We found that web views created via Options => Display Web Page did respect other layout considerations. It was unclear what is causing the problem or how to correct or work around it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions