Fl4m3Ph03n1x

Fl4m3Ph03n1x

Background

I havea live component that is basically a form with a couple of text inputs and a submit button.
I have the interface kinda looking the way I want, but there is a problem: I cannot input anything into the text input fields.

And I have no idea why.

Code

As you can see I have 2 text input fields.

My code is the following:

defmodule WebInterface.Live.Window.Main.Authenticate do
  @moduledoc """
  LiveView subcomponent for the Authenticate page as part of the Main subcomponent.
  This subcomponent has the forms for the user's authentication.
  """

  use WebInterface, :live_component

  alias Elixir.Phoenix.LiveView.Rendered

  @spec render(map) :: Rendered.t
  def render(assigns) do
    ~H"""
      <div class="header">
        <h2>Description</h2>
        <p><%= @selected_command.description %></p>
      </div>
      <div class="body">
        <form>
          <div class="intro">
            <h3>Authentication</h3>
            <p>Fill the Cookie and token. Lorem Ipsum.</p>
          </div>
          <label for="cookie">Cookie: </label>
          <input type="text" id="cookie" name="cookie"/>

          <label for="token">Token: </label>
          <input type="text" id="token" name="token"/>
        </form>
        <button
          phx-click="execute_command"
          phx-value-command={@selected_command.id}
          >
            Save
        </button>
      </div>
    """
  end

end

At first I thought this was happening because I was not using text_input, however, after replacing the <input type="text" id="cookie" name="cookie"/> with it, the same happens.

Questions

I am using here plain HTML for the most part. I know Phoenix has some helpers, but I am not sure on how I would even use them here, so I am staying away from it for now.

How can I fix this?

Showing Posts 1 to 7

LostKobrakai

LostKobrakai

Can you be a bit more detailed? Do you see a cursor, does it flicker but reset, does it do nothing?

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

When I click it, nothing happens.
I would expect to see a | inside of the text box when I click it, but this does not happen. Its like it is preventing the input.

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Do you see any errors in your browser console or phoenix console?

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

ezgif.com-gif-maker

This is what happens. You can see I am fanatically clicking the text input boxes, but nothing happens.

  • Is this because I am not using Phoenix Helpers? Do I need to remake the whole thing?
  • Am I missing some phx-something in the form?

No errors appear in the console either.

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

After some investigation I found the cause for the issue in my assets\css\app.css:

.hidden {
    opacity: 0;
    height: 0px;
}

.show {
  opacity: 1;
  transition: opacity 0.6s linear;
}

This piece of code (that shows and hides the forms) makes it so I can not type into them.
Why is this happening?

I also realize the native Phoenix css code has something similar in the same file:

  .fade-in-scale {
    animation: 0.2s ease-in 0s normal forwards 1 fade-in-scale-keys;
  }
  
  .fade-out-scale {
    animation: 0.2s ease-out 0s normal forwards 1 fade-out-scale-keys;
  }
  
  .fade-in {
    animation: 0.2s ease-out 0s normal forwards 1 fade-in-keys;
  }
  .fade-out {
    animation: 0.2s ease-out 0s normal forwards 1 fade-out-keys;
  }
  
  @keyframes fade-in-scale-keys{
    0% { scale: 0.95; opacity: 0; }
    100% { scale: 1.0; opacity: 1; }
  }
  
  @keyframes fade-out-scale-keys{
    0% { scale: 1.0; opacity: 1; }
    100% { scale: 0.95; opacity: 0; }
  }
  
  @keyframes fade-in-keys{
    0% { opacity: 0; }
    100% { opacity: 1; }
  }
  
  @keyframes fade-out-keys{
    0% { opacity: 1; }
    100% { opacity: 0; }
  }
  

Could there be a conflict?

Fl4m3Ph03n1x

Fl4m3Ph03n1x OP

After more experimentation, I found that if I stop using my css classes hidden and show and instead use fade-out and fade-in (from Phoenix), the text inputs work.

However, Because I am not removing the elements from the page, I am just left with huge blank spaces.

What so special about my classes that they mess Phoenix text inputs?

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

The browser has no idea these are from phoenix, these are regular text inputs not “phoenix” text inputs. I’m not sure about the interaction going on between the CSS and the DOM but this isn’t really specific to phoenix. I would make sure live view isn’t doing some sort of crazy rendering loop where it’s re-rendering rapidly or something and overloading the browser but as long as that isn’t happening this seems mostly just a core CSS / HTML question.

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews