kolibri-design-system icon indicating copy to clipboard operation
kolibri-design-system copied to clipboard

KButton somtimes generates a <button> tag and sometimes an <a> tag

Open indirectlylit opened this issue 4 years ago • 1 comments

Apparently I made this change at some point for the sake of practicality during a release, and managed to overlook the conceptual incorrectness of it:

https://github.com/learningequality/kolibri/commit/5e8ea52ad8cbdedb437f76a6694cd0295445bab2#diff-ab749d7e6ba0a5ae26b35fdd4180ce678aa8f1f6f2b0538f627f4f32312458e1R91-R100

      htmlTag() {
        // Necessary to allow basic links to be rendered as 'inline' instead of
        // 'inline-block': https://stackoverflow.com/a/27770128
        if (this.appearance === 'basic-link') {
          return 'a';
        }
        return 'button';
      },

The fundamental challenge was allowing link-styled buttons to wrap across multiple lines, which as described in the linked SO reference is not possible...

However, this contradicts literally the first sentence of guidance we have in button documentation:

image

All this might be to say that our current API and guidance is not appropriate and should eventually be revisited. If and when we decide that KIconButtons also need a and router-link variations we should also address this issue.

ref: https://github.com/learningequality/kolibri-design-system/issues/166

indirectlylit avatar Feb 20 '21 02:02 indirectlylit