question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Radio and Select extra option added on Safari < 13

See original GitHub issue

Reproduction

https://github.com/totalhack/formkit-starter

Describe the bug

On somewhat older versions of Safari, such as Safari 12 which is on my 2017 Macbook Pro, it seems an extra option is added to radio and select inputs. This does not happen in Safari 13 or any recent versions of Chrome/Firefox. I searched and could not find any particular issue or bug report for Safari < 13 that would explain this, so I’m thinking this could be a formkit issue.

The radio in the demo app is defined as follows, with two options:

        <FormKit
          name="opinion"
          label="Opinion"
          help="How excited are you about FormKit?"
          type="radio"
          value="A lot"
          :options="['A little', 'A lot']"
        />

But it renders html like this, with a third blank option added:

<ul class="formkit-options">
   <li class="formkit-option">
      <label class="formkit-wrapper">
         <div class="formkit-inner">
            <!----><input type="radio" class="formkit-input" name="opinion" id="opinion-option-a-little" value="A little"><span class="formkit-decorator" aria-hidden="true"></span><!---->
         </div>
         <span class="formkit-label">A little</span>
      </label>
      <!---->
   </li>
   <li class="formkit-option">
      <label class="formkit-wrapper">
         <div class="formkit-inner">
            <!----><input type="radio" class="formkit-input" name="opinion" id="opinion-option-a-lot" value="A lot"><span class="formkit-decorator" aria-hidden="true"></span><!---->
         </div>
         <span class="formkit-label">A lot</span>
      </label>
      <!---->
   </li>
   <li class="formkit-option">
      <label class="formkit-wrapper">
         <div class="formkit-inner">
            <!----><input type="radio" class="formkit-input" name="opinion"><span class="formkit-decorator" aria-hidden="true"></span><!---->
         </div>
         <!---->
      </label>
      <!---->
   </li>
</ul>

The “modeled group values” output also shows an unusual value, note the __init key being set which doesn’t happen in normal behavior:

{
  "__init": true,
  "opinion": "A lot"
}

Why do I need Safari 12 to work? I’m trying to use formkit in a scenario where I will use the standard module/nomodule pattern to load my “modern” bundle in all browsers that support es6 modules and a more heavily polyfilled bundle to the nomodule browsers. Safari 12 is in the group that supports es6 modules and something I would consider modern enough that it probably should work. Even with polyfills to match es6+ browsers it doesn’t seem to work.

The reproduction link is a copy of of the formkit starter project with some modifications to the postcss behavior and a vite target of es6 to get things close to working in Safari 12. This “extra item” bug is the only thing preventing this from working that I’ve found.

Thanks for taking a look.

Environment

• OS: Mac OS • Browser: Safari • Version: < 13

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
justin-schroedercommented, Jun 28, 2022

Was able to identify the extra option issue. I have not been able to duplicate any non-selection issues. Checking why __init isn’t being hidden. that might be unavoidable.

0reactions
totalhackcommented, Jun 29, 2022

Thanks @justin-schroeder. I’ll retest once this is released and let you know if I still hit the radio click issue. I can also work around __init with some filtering before posting if needed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change Websites settings in Safari on Mac - Apple Support
To apply a setting to a website on the right, first select the setting, then choose the option you want from the pop-menu...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Added the display of a thumbnail of selected file for <input type=file> on macOS ... Fixed unwanted extra dash when autocompleting CSS variable...
Read more >
Customize your Safari settings on iPhone - Apple Support
Customize your start page · Tap the Tabs button , then tap · Scroll to the bottom of the page, then tap Edit....
Read more >
Open and close tabs in Safari on iPad - Apple Support
Touch and hold the New Tab button , then choose from the list of recently closed tabs. The Safari sidebar on the left...
Read more >
About iCloud Private Relay - Apple Support
Learn how iCloud Private Relay — part of an iCloud+ subscription — helps protect your privacy when you browse the web in Safari....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found