Comments (12)
For those finding this and use Tailwind, this fixed it for me:
# config/dev.exs
config :my_app, MyAppWeb.Endpoint,
live_reload: [
iframe_attrs: [style: "display: none"], # <-- add this
patterns: [...]
]
-- EDIT, adjusted to use style attribute instead of Tailwind class to avoid needing to configure PurgeCSS
from phoenix_live_reload.
v1.3.1 is out!
from phoenix_live_reload.
If you want to actually customize it to something else, style makes it impossible, which is why we removed it.
from phoenix_live_reload.
If your css classes are overriding it, then the best is to use CSS to override it again. The issue with using style is that it doesn’t work with CSP, so it is bound to have pitfalls there too. In any case, I learned about hidden’s fragility, so this is good to know. Thank you!
from phoenix_live_reload.
Is there any drawback of using both style="display: none"
and hidden
as default?
from phoenix_live_reload.
For Tailwind, if you're using the new JIT compiler the above solution posted by @dbernheisel no longer works out of the box.
You also need to add the config file paths to PurgeCSS, such as:
purge: [
'/app/assets/**/*.js',
'/app/config/**/*.exs',
'/app/lib/hello_web/**/*.eex',
'/app/lib/hello_web/**/*.leex'
]
from phoenix_live_reload.
Good point. Or alternatively define a rule directly in your css and don't depend on Tailwind for this particular case!
from phoenix_live_reload.
It looks like another alternative solution is to put width="0" height="0"
on the iframe
itself. Any chance of this getting re-opened and evaluated as a fix because then it requires no app level custom CSS in every project to workaround this issue.
I've tested it on Windows Chrome, FireFox and Edge and it works.
The idea was taken from the Elixir Forums here: https://elixirforum.com/t/does-anyone-know-why-phoenixs-live-reload-hidden-iframe-is-set-to-be-visible-in-the-dom-by-default/38900/6
from phoenix_live_reload.
@nickjj can you please send a PR? It would be very welcome!
from phoenix_live_reload.
Actually, I will go ahead and do it and ship a new release right now, since I have some before bed time. :)
from phoenix_live_reload.
Are you sure? I'm ok with opening the PR. This isn't a life or death request haha.
The only concern is I haven't tested this on macOS, Safari or other devices (lack of devices).
from phoenix_live_reload.
For future reference here is the commit: 13938e9
from phoenix_live_reload.
Related Issues (20)
- Problems with page reload strategy in LiveView pages embedded via cross-domain iframes HOT 3
- Add debounce for live reloading HOT 5
- Live Reload isn't joining the channel HOT 3
- add new prefix option
- 1.6 support? HOT 2
- Live reload injected in wrong `body` HOT 1
- Changes to Functional Components not reloading correctly HOT 2
- Add option to do full page reloads when CSS changes HOT 3
- Unable to specify custom prefix for `live_reload/frame` url HOT 4
- Watch for changes outside the project folder HOT 1
- Browser freezing for two minutes on LiveReload HOT 3
- Release v1.3.4
- Debounce live reload events HOT 6
- Live reload breaks debugging session in elixirLS debugger HOT 4
- Live reload not triggering HOT 2
- Reciprocating a `Cross-Origin-Embedder-Policy` (COEP) of `require-corp`
- Warning during compilation on Elixir 1.15.x HOT 3
- Warn if no <body> present HOT 8
- LiveReload requires unsafe-inline script_src for CORS HOT 4
- Update FileSystem to 1.0.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phoenix_live_reload.