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

Add HTML5 attributes support to the EditText widget #4230

Open
abesamma opened this issue Sep 1, 2019 · 10 comments
Open

Add HTML5 attributes support to the EditText widget #4230

abesamma opened this issue Sep 1, 2019 · 10 comments

Comments

@abesamma
Copy link
Contributor

abesamma commented Sep 1, 2019

Issue: EditText widget currently does not support common, and important HTML5 attributes such as:

  1. min
  2. max
  3. step
  4. pattern
  5. etc

Proposed solution: Pull request to add support via factory.js for EditText widget, and simple.js toolbar engine files.

Here's a demo of the plugin I've created that adds 3 of these attributes to a seperate EditTextPlus widget. Works exactly the same way as the native EditText widget, but with a different name.

@abesamma abesamma changed the title Adding HTML5 attributes support for EditText Adding HTML5 attributes support to the EditText widget Sep 1, 2019
@abesamma abesamma changed the title Adding HTML5 attributes support to the EditText widget Add HTML5 attributes support to the EditText widget Sep 1, 2019
@twMat
Copy link
Contributor

twMat commented Sep 2, 2019

I believe this is covered by the rangewidget

@abesamma
Copy link
Contributor Author

abesamma commented Sep 2, 2019

@Jermolene which would be more appropriate here if I may ask? A commit to the core, or a plugin commit to address this issue?

@abesamma
Copy link
Contributor Author

abesamma commented Sep 2, 2019

@twMat that widget only applies to range type and not number type input. Since this deals with numbers in a text field, it would be more appropriate for the edit - text widget.

@abesamma
Copy link
Contributor Author

abesamma commented Sep 2, 2019

@twMat and of course, there are still many relevant but unsupported attributes to consider besides those listed e.g. Pattern.

@Jermolene
Copy link
Owner

Thanks @abesamma @twMat -- I'd forgotten about the range widget (it was added in #2988). The reason that we didn't include validation attributes like pattern in the edit-text widget(s) originally was that browser support was so poor, it may well be reasonable to add them now.

@abesamma
Copy link
Contributor Author

abesamma commented Sep 2, 2019

@Jermolene glad you agree. However, to reiterate my point, range input does not mean much for the number type input. It only applies to the range input. So we should also consider supporting min, maxand step in edit-text as well.

@abesamma
Copy link
Contributor Author

abesamma commented Sep 2, 2019

Even I had forgotten about the range widget 😅

@Jermolene
Copy link
Owner

Hi @abesamma at the moment we generally use a separate widget for each type variant of the "input" element. The edit text widget when used with tag="input" only supports type="text" (except for registering custom types for specific fields via the tiddler module mechanism, as we do for the "color" field).

So, I think I'd favour exposing <input type="number"> as a new widget, rather than making the edit text widget(s) any more complicated.

@abesamma
Copy link
Contributor Author

abesamma commented Sep 2, 2019

I think that's a good idea, but I thought edit-text was designed to support the number input as well, given that the original widget as it is responds to the input type number, range accordingly. I didn't realize that its usage is restricted to text.

Anyway, if that is the convention, then there is a lot to implement, given the sheer variety of input types and their respective attributes. And a lot of them already have broad support currently.

@telmiger
Copy link
Contributor

I use the edit text widget in a new project and it produces an input of type number as expected. Just without the necessary config options mentioned in the OP.

The documentation made not clear for me, that the type attribute would be restricted to "text". It says:

Applying the EditTextWidget to any other field generates an HTML element, a single-line editor. This behaviour can be overridden with the tag and type attributes.

And in the table, the explication for the type attribute is:

Overrides the generated HTML editing element type attribute

So "number" seemed to be a valid type. If this is not the case, I would suggest to make the docs clearer.

Is there any hope that we get a widget for inputs of the type number soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants