PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: svg/svgo (js)
Issue: Prevent SVG aria attributes from being removed
Is it possible with any combination of settings to prevent `aria-*` attributes from being remove from the `<svg>` tag when optimising? 

I have tried all options that seem relevant to this but have had no luck so far:
```
.pipe($.svgo({
    addAttributesToSVGElement: true,
    removeUnknownsAndDefaults: false,
    cleanupAttrs: false,
    removeEmptyAttrs: false
}))
```

This is quite important as the `aria-labelledby` and `aria-describedby` attributes allow screen readers to interpret the content of inline SVG's.
Pull request description: Add keepAriaAttrs to removeUnknownsAndDefaults
Closes #684.

Adds a `keepAriaAttrs` option to `removeUnknownsAndDefaults`, with a default value of `true`. And adds two cases to make sure it works.



Patch:
diff --git a/plugins/removeUnknownsAndDefaults.js b/plugins/removeUnknownsAndDefaults.js
index 341b1fd..adfd487 100644
--- a/plugins/removeUnknownsAndDefaults.js
+++ b/plugins/removeUnknownsAndDefaults.js
@@ -11,7 +11,8 @@ exports.params = {
     unknownAttrs: true,
     defaultAttrs: true,
     uselessOverrides: true,
-    keepDataAttrs: true
+    keepDataAttrs: true,
+    keepAriaAttrs: true
 };
 
 var collections = require('./_collections'),
@@ -105,7 +106,8 @@ exports.fn = function(item, params) {
                 if (
                     attr.name !== 'xmlns' &&
                     (attr.prefix === 'xml' || !attr.prefix) &&
-                    (!params.keepDataAttrs || attr.name.indexOf('data-') != 0)
+                    (!params.keepDataAttrs || attr.name.indexOf('data-') != 0) &&
+                    (!params.keepAriaAttrs || attr.name.indexOf('aria-') != 0)
                 ) {
                     if (
                         // unknown attrs


Test patch:
diff --git a/test/plugins/removeUnknownsAndDefaults.11.svg b/test/plugins/removeUnknownsAndDefaults.11.svg
new file mode 100644
index 0000000..201f74d
--- /dev/null
+++ b/test/plugins/removeUnknownsAndDefaults.11.svg
@@ -0,0 +1,19 @@
+<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="title">
+    <title id="title">
+        Title
+    </title>
+    <g aria-label="foo">
+        test
+    </g>
+</svg>
+
+@@@
+
+<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="title">
+    <title id="title">
+        Title
+    </title>
+    <g aria-label="foo">
+        test
+    </g>
+</svg>
diff --git a/test/plugins/removeUnknownsAndDefaults.12.svg b/test/plugins/removeUnknownsAndDefaults.12.svg
new file mode 100644
index 0000000..727ba6f
--- /dev/null
+++ b/test/plugins/removeUnknownsAndDefaults.12.svg
@@ -0,0 +1,23 @@
+<svg xmlns="http://www.w3.org/2000/svg" aria-labelledby="title">
+    <title id="title">
+        Title
+    </title>
+    <g aria-label="foo">
+        test
+    </g>
+</svg>
+
+@@@
+
+<svg xmlns="http://www.w3.org/2000/svg">
+    <title id="title">
+        Title
+    </title>
+    <g>
+        test
+    </g>
+</svg>
+
+@@@
+
+{ "keepAriaAttrs": false }