positron icon indicating copy to clipboard operation
positron copied to clipboard

Should the viewer pane display the page title?

Open seeM opened this issue 1 year ago • 5 comments

Here's what it currently looks like:

image

Perhaps we could use a similar treatment to the help pane – although without the history navigation?

image

seeM avatar Jun 28 '24 11:06 seeM

Do you mean adding a small header that has the title of the page? Or replacing the URL?

nstrayer avatar Jun 28 '24 19:06 nstrayer

I think the URL is helpful too, so maybe a small header below that. What do you think?

seeM avatar Jun 29 '24 00:06 seeM

Im mildly weary of taking up more vertical space, but I guess it works fine for help. Another alternative would be the title displaying over the url bar which then on hover, hides to give the user access to the url bar functionality.

nstrayer avatar Jul 01 '24 14:07 nstrayer

Yeah it's not unusual in Positron/VSCode to have two action bars taking vertical space. I think I'd start to get worried at 3 though.

seeM avatar Jul 02 '24 10:07 seeM

In #4151 I added some plumbing to show the page title instead of the URL. Here's a page with a <title>ggplot2 demo</title>:

image

However, we currently only show this for HTML files / widgets, since those don't have a meaningful URL and 95% of the file paths are randomly named temp files in the temp dir.

We also need to cheat a little to read the title, since security policy ordinarily would prevent us from being able to read the title inside the <iframe>; the cheat in this case is using the Electron APIs to inject some JavaScript on the page that fires a did-load-window postmessage from inside the iframe to let the parent know what its title is.

jmcphers avatar Jul 25 '24 22:07 jmcphers