LiveView fallback possible w/o Javascript?

Hi there, I’ve been playing with Pheonix LiveView for a new project, and would like to avoid as much client-side logic (JS) as possible. One of the odd requirements in the project is being able to load a fully functional page without Javascript enabled to make interactions bulletproof and fast on mobile devices with intermittent connections.

Is this possible? Has anyone tried using only form actions in their LiveView templates so that if JS doesn’t run on the page we can still have a fully functional application? Thanks!

1 Like

It works, but you just have to be careful when writing the pages to not have any functionality require a phx-click or phx-submit event. Certain things like forms work pretty well. Other things like modals aren’t gonna work at all. It really depends on what you mean by “fully-functional”. If one of the functions of the form is autocomplete, that just flat won’t work without javascript regardless of backend.

3 Likes

Thanks @benwilson512, didn’t realize I just needed to watch my use of phx-click and phx-submit, I’ll give that a try. I should have been more specific and said the primary functionality (of a form for instance) should work, graceful degradation essentially. If there are some things like autocomplete than I’d like to fallback to another experience… Thanks, appreciate your comment!

1 Like