5 Matching Annotations
  1. Feb 2021
    1. Grouped inputs It can be convenient to apply the same options to a bunch of inputs. One common use case is making many inputs optional. Instead of setting default: nil on each one of them, you can use with_options to reduce duplication.

      This is just a general Ruby/Rails tip, nothing specific to active_interaction (except that it demonstrates that it may be useful sometimes, and gives a specific example of when you might use it).

      Still, in my opinion, this doesn't belong in the docs. Partly because I think repeating the default: nil for every item is an acceptable type of duplication, which would be better, clearer (because it's more explicit), simpler, keeps those details closer to the place where they are relevant (imagine if there were 50 fields within a with_options block).

      I also think think that it creates a very arbitrary logical "grouping" within your code, which may cause you to unintentionally override/trump / miss the chance to use a different, more logical/natural/important/useful logical grouping instead. For example, it might be more natural/important/useful to group the fields by the section/fieldset/model that they belong with, even if your only grouping is a comment:

      # User fields
      string :name
      integer :age
      date :birthday, default: nil
      
      # Food preferences
      array :pizza_toppings
      boolean :wants_cake, default: nil
      

      may be a more useful grouping/organization than:

      # Fields that are required
      string :name
      integer :age
      array :pizza_toppings
      
      # Fields that are optional
      with_options default: nil do
        date :birthday
        boolean :wants_cake
      end
      

      Or it might be better to list them strictly in the same order as they appear in your model that you are trying to match. Why? Because then you (or your code reviewer) can more easily compare the lists between the two places to make sure you haven't missed any fields from the model, and quickly be able to identify which ones are missing (hopefully intentionally missing).

      In other words, their "optionalness" seems to me like a pretty incidental property, not a key property worthy of allowing to dictate the organization/order/grouping of your code.

  2. Oct 2020
    1. Typically, platform accessibility APIs do not provide a vehicle to notify assistive technologies of a role value change, and consequently, assistive technologies may not update their cache with the new role attribute value.

      It's too bad they couldn't just allow role to be changed, and assistive technologies would just have to be updated to follow the suit.

    1. It would be straighforward though to change it so it matched exactly, or to remove the browser dependency (so it could run on the server, eg.)
    1. The limits are chosen to avoid wrapping in editors with the window width set to 80, even if the tool places a marker glyph in the final column when wrapping lines.