Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to save ACF Field Groups after activating this plugin #149

Closed
benknight opened this issue Jun 22, 2020 · 3 comments
Closed

Unable to save ACF Field Groups after activating this plugin #149

benknight opened this issue Jun 22, 2020 · 3 comments
Labels
bug Something isn't working 🚀 Actionable

Comments

@benknight
Copy link

After I activate this plugin I'm unable to update or save new ACF Field Groups.

When I open the console, I see the following error when clicking the Update/Publish button on my Field Group:

An invalid form control with name='acf_field_group[graphql_field_name]' is not focusable.
@benknight
Copy link
Author

Version information:

wp-graphql-acf 0.3.4 (also tried 0.3.3, same issue)
wp-graphql 0.9.1
acf 5.8.12
wordpress 5.4.2

@benknight
Copy link
Author

benknight commented Jun 22, 2020

After digging around a bit more, it looks like I might have narrowed down the cause.

I discovered that the console error "An invalid form control… etc" seems to be a Chrome-specific error meaning that an input element that is marked as "required" is not visible. This is because the normal native browser form validation behavior is to put user keyboard focus on any empty required input on form submission event, but since this element is not visible by default (it's hidden inside the ACF Field Group's "Settings" panel which is collapsed by default), it's unable to focus, hence the error.

Source: https://tiffanybbrown.com/2015/11/an-invalid-form-control-is-not-focusable/index.html

The end result is a silent failure to save/update a Field Group.

The only way to work around this is to give every ACF Field Group a GraphQL Field Name (even if it's not marked "Show in GraphQL". Since someone wouldn't otherwise know this is the cause of the issue described I think it's fair to call it a bug. The fix would likely involve only marking the "GraphQL Field Name" input as required when "Show in GraphQL" is toggled on.

@jasonbahl jasonbahl added the bug Something isn't working label Jun 22, 2020
@bhardie bhardie added this to the ACF Schema Location Rules milestone Apr 20, 2021
@jasonbahl
Copy link
Contributor

👋🏻 @benknight v0.5.0 (#250) makes significant changes to the GraphQL Field Group Settings.

The graphql_field_name is now conditional based on the show_in_graphql state.

If the Field Group is set to NOT show_in_graphql then the graphql_field_name is NOT required and is hidden.

If the Field Group IS set to show_in_graphql then the graphql_field_name becomes visible and is required.

In action:

acf-field-group-condition

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🚀 Actionable
Projects
None yet
Development

No branches or pull requests

3 participants