web-accessibility icon indicating copy to clipboard operation
web-accessibility copied to clipboard

Adapt some patterns

Open Mars073 opened this issue 3 years ago • 4 comments

Hello, I had a problem with HTML tag pattern:

  • it matches with typescript generic interfaces
  • it matches all tags that start with html
<template>
<div>
  <html5-custom-tag /> <!-- Provide a language [lang=""] -->
</div>
</template>
<script lang="ts" setup>
// ...
const myTag: Ref<HTMLDivElement | null>(null); // Provide a language [lang=""]
// ...
</script>

I modified some regexes, I don't know if it was more optimized before, but I find my version more "simple". 🙃

Mars073 avatar Mar 08 '22 21:03 Mars073

Dankjewel! I will have to write some test cases to check if it's still working in all cases.

I should have done this a long time ago; there are some weird cases where some regex will not work if there is line wrapping example:

<span
  class="btn"
  ...
>

I have added a quick setup in the dev branch called /playground, but it is far from complete and will be adding more cases so I can test.

mvdschee avatar Mar 09 '22 07:03 mvdschee

I did some tests and noticed that the expression didn't work if the number of characters was even or odd, I think it was groups with \s that were evaluated wrong. I've tried all the playground tests and (I hope) everything is good now 🙈

I think there is a problem in the logic of the validateSpan, role="button" is supposed to be wrong? image

Mars073 avatar Mar 09 '22 17:03 Mars073

@Mars073 I will do some more checks and add the rest to make sure it does everything like before but I think it will be fine.

Hmm yes span with role="button" is correct, it shouldn't give a warning even tho you should really just keep using a button for any clicks with JS that is not a link

mvdschee avatar Mar 13 '22 10:03 mvdschee

I have checked and what is happening is the span should not have been disabled, I made semanticExclude work on all issues for span which should have just been for the semantic issue. I will change that

mvdschee avatar Mar 13 '22 12:03 mvdschee