"Using a Field Strategy" documentation

Hi all,
I found an issue in this Lit Binder Field Strategy Docs. Using Vaadin 24.6.12.

When overriding the getFieldStrategy method and no model?: AbstractModel is given to the super call, the Checkbox value binding is broken. Changing the value in the form does result in a wrong value put in the bean:

  • true/checked is false
  • false/not checked is undefined

Before I open a issue in GitHub, Is there anything I am missing?

Suggested change in the documentation would be:

  override getFieldStrategy(element: any, model?: AbstractModel): FieldStrategy {
    if (element.localName === 'my-text-field' && model instanceof StringModel) {
      return new MyTextFieldStrategy(element);
    }
-  return super.getFieldStrategy(element);
+  return super.getFieldStrategy(element, model);
  }
}
1 Like

Go ahead and create a ticket. Even if the documentation is technically right it’s clearly not obvious on why and thus could be improved.

1 Like

Created ticket “Using a Field Strategy” documentation · Issue #4447 · vaadin/docs · GitHub