ryantownsend,
@ryantownsend@webperf.social avatar

@bramus reading through the Virtual Keyboard shenanigans and your name pops up a lot. Firstly, thank you for trying to make some sense of it all / standardise 🙏

Is there a reason there's no viewport unit for this? (kinda like a modified svh) or has that idea been proposed/rejected for some reason?

Unless I'm missing something, it seems overly complex to change how the viewport behaves across a whole site just for the occasional situation you need something to float above a keyboard?

Schepp,
@Schepp@mastodon.social avatar

@ryantownsend @bramus Apart from some future meta[name="viewport"] path, right now there is only the Visual Viewport API that you can use. You could dig a little into this, although meant as bug report, but probably picturing your use case: https://schepp.dev/demos/webkit-visual-viewport-api-bug/

I do agree that it would be good to have one more dynamic viewport height unit that factors in soft keyboards.

ryantownsend,
@ryantownsend@webperf.social avatar

@Schepp @bramus yeah, having to listen on resize makes me sad. Especially as Safari seems to fire events sporadically so there’s a noticeable delay.

Something like vvh/vvw (Visible Viewport Height/Width) would be ideal, but I’d just be happy to see env(keyboard-inset-height) supported without needing any other changes.

bramus,
@bramus@front-end.social avatar

@ryantownsend @Schepp In Chrome you can use the interactive-widget key in the viewport meta tag to change the resize behavior.

https://developer.chrome.com/blog/viewport-resize-behavior#opting_in_to_a_different_behavior

Unfortunately Chrome is the only browser to support this.

ryantownsend,
@ryantownsend@webperf.social avatar

@bramus @Schepp the trouble is you can't (presumably) have elements positioned using both behaviours at once.

If there was control via a viewport unit in CSS, then we could position individual elements without having to change browser behaviour? e.g. some could react to the visual viewport, while others may not.

ryantownsend,
@ryantownsend@webperf.social avatar

@bramus @Schepp an example use-case:

I’d want an action button to remain within the visual viewport but a non-dismissed floating cookie banner to remain attached to the layout viewport as it should be unobtrusive.

bramus,
@bramus@front-end.social avatar

@ryantownsend @Schepp Great use-case! Could you leave this as a comment on this CSSWG issue?

https://github.com/w3c/csswg-drafts/issues/7475#issuecomment-1182982687

ryantownsend, (edited )
@ryantownsend@webperf.social avatar
bramus,
@bramus@front-end.social avatar
Schepp,
@Schepp@mastodon.social avatar
  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • InstantRegret
  • ethstaker
  • magazineikmin
  • osvaldo12
  • rosin
  • mdbf
  • Youngstown
  • khanakhh
  • slotface
  • Durango
  • kavyap
  • ngwrru68w68
  • thenastyranch
  • provamag3
  • tacticalgear
  • cisconetworking
  • GTA5RPClips
  • modclub
  • cubers
  • normalnudes
  • everett
  • tester
  • megavids
  • Leos
  • anitta
  • JUstTest
  • lostlight
  • All magazines