GithubHelp home page GithubHelp logo

Comments (6)

marijnh avatar marijnh commented on May 24, 2024

The problem seems to be that A) the validation attributes are checked before the onsubmit event is fired, so if CodeMirror clears the textarea, it'll be happily submitted, because it had something in it before, and B) the hint that pops up when the form is not submitted (which happens when the texarea was empty to begin with), seems to be placed in such an incoherent way (at least on Chrome) that it either doesn't show up at all (when the textarea has an absolute position) or ends up way in the wrong place (when the textarea is given a height of 0).

There doesn't appear to be a way to make CodeMirror play nice with such attributes, short of reimplementing them, which is out of CodeMirror's scope.

from codemirror-v1.

qpleple avatar qpleple commented on May 24, 2024

Yes indeed.

So what do you choose? Saying that CodeMirror work only without requiredattribute or maybe find a fix?

If you don't want to extend CodeMirror scope to reimplementing such attributes, would you accept checks for these attributes and notice if they're here ?

from codemirror-v1.

marijnh avatar marijnh commented on May 24, 2024

It could easily notice the attribute, or some other HTML5 validation attribute, is there, but how would it respond?

from codemirror-v1.

qpleple avatar qpleple commented on May 24, 2024

Not creating the CodeMirror object and fail with a log message so that the developer knows something is wrong and that he has to remove the requiredattribute to make it work.

from codemirror-v1.

marijnh avatar marijnh commented on May 24, 2024

I'd say it is the library user's responsibility to not create CodeMirror instances for his/her textareas in such a case. There are a lot of other broken ways to use CodeMirror, and I don't want to start testing for all of them in the library (mostly for file size reasons -- such extra code adds up).

from codemirror-v1.

qpleple avatar qpleple commented on May 24, 2024

All right, fair enough.

from codemirror-v1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.