-
Notifications
You must be signed in to change notification settings - Fork 217
allowfullscreen added #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
allowfullscreen added #687
Conversation
Reading through the Mozilla documentation it looks like this property is considered legacy and they suggest |
@thomashoneyman that's a good idea. Do you know if It seems that Also, should the sum type go in src/Halogen/HTML/Properties.purs? |
Do not accept yet I am adding multiple value capabilities |
now takes multiple values |
It looks like it uses the syntax of feature policies that also can be set in HTTP requests: https://developer.mozilla.org/en-US/docs/Web/HTTP/Feature_Policy/Using_Feature_Policy Syntax and list of features here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Feature-Policy Maybe a Map would be appropriate? |
It is annoying that they "allow" so many syntactic differences. |
@MonoidMusician Didn't use Map but did include a key value constructor. |
@MonoidMusician @thomashoneyman Is there anything else that needs to be done here? |
@@ -288,8 +292,41 @@ poster = prop (PropName "poster") | |||
preload :: forall r i. I.PreloadValue -> IProp (preload :: I.PreloadValue | r) i | |||
preload = prop (PropName "preload") | |||
|
|||
allow :: forall r i. Allow -> IProp (allow :: String | r) i | |||
allow = prop (PropName "allowfullscreen") <<< renderAllow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
allow = prop (PropName "allowfullscreen") <<< renderAllow | |
allow = prop (PropName "allow") <<< renderAllow |
Shouldn't this have the prop name "allow"
?
draggable :: forall r i. Boolean -> IProp (draggable :: Boolean | r) i | ||
draggable = prop (PropName "draggable") | ||
|
||
tabIndex :: forall r i. Int -> IProp (tabIndex :: Int | r) i | ||
tabIndex = prop (PropName "tabIndex") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a moment to walk through the documentation on MDN. I’d like to share some snippets from the documentation that describe the purpose and syntax of this policy — I wasn’t aware of this information until this moment, so I’d like to share these in case other reviewers are also unfamiliar with how this works! Then, with this knowledge in hand, I’d like to share what adjustments I think should be made to the types. The Feature Policy page summarizes what this policy is about:
You can enforce some restrictions on APIs and features that a website can use. This can be done via an HTTP header or via the
This gives more direction on what exactly Using the MDN terminology brings to mind another way to structure the types:
There are many ways we could define types to capture this structure. For example, a minimal version might say that But there’s yet more detail about what constitutes an acceptable allowlist:
So it’s not quite correct that you can just have a list of origins. Instead, you can either have:
So perhaps we would want to have a
Turning now to what features might make up a In the current type only two of these directives are represented ( Whew! Sorry for such a lengthy dive into the documentation, but I wanted to get this information out into this PR so we can all use it as a basis for further discussion. With all of this in mind, I think that we should adjust these types a little bit to accommodate the MDN specification. Here’s what I propose (but I’m open to other suggestions): First,
Second, Third, the Finally, we should have a string renderer which follows these rules:
As a bonus (which I’m happy to add on to your PR as a follow-up), it would be really nice to have a test that makes sure that the formatting is correct for various cases: -- fromFoldable [ Tuple Fullscreen Nothing ]
"fullscreen"
-- fromFoldable [ Tuple Fullscreen (Just [ SrcOrigin ]) ]
"fullscreen 'src'"
-- fromFoldable [ Tuple Geolocation (Just [ Origin "https://example.com", "https://google-developers.appspot.com" ]) ]
"geolocation https://example.com https://google-developers.appspot.com"
-- fromFoldable [ Tuple Camera (Just NoOrigin), Tuple Microphone (Just NoOrigin) ]
"camera 'none'; microphone 'none'" Finally, it’s worth noting this little warning in the MDN documentation:
So perhaps any reference to ‘Feature’ in this review should really be ‘Permission’ @BebeSparkelSparkel I understand this bumps up the work necessary to get this PR merged, and I'm sorry to be requesting that additional work. On the other hand, doing so would mean you're really adding the ability to support permission policies to Halogen, which is a pretty big (and welcome) addition! |
Lot of things going on right now. I'll try read this soon |
iframe can go full screen
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#attr-allowfullscreen