Skip to content

Commit

Permalink
Merge pull request #169 from quid/fix/QUID-27512-firefox-sorting-issue
Browse files Browse the repository at this point in the history
fix: sorting issue on FireFox
  • Loading branch information
ben-pyt authored Feb 8, 2023
2 parents 192f4d1 + 8c2740a commit 33ff4d9
Show file tree
Hide file tree
Showing 6 changed files with 2,256 additions and 2,154 deletions.
3 changes: 2 additions & 1 deletion packages/react-dropdown/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@quid/react-dropdown",
"version": "4.11.1",
"version": "4.11.3",
"description": "React dropdown component with ARIA accessibility and advanced functionalities",
"main": "dist/index.js",
"main:umd": "dist/index.umd.js",
Expand Down Expand Up @@ -32,6 +32,7 @@
"@emotion/styled": "^10.0.6",
"@emotion/styled-base": "^10.0.4",
"@quid/react-core": "^4.10.0",
"@quid/react-dropdown": "^4.11.1",
"@quid/theme": "^4.10.0",
"color": "^3.1.0",
"downshift": "^3.2.0",
Expand Down
14 changes: 13 additions & 1 deletion packages/react-dropdown/src/Categories.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,19 @@ export default function DropdownCategories({

// Add index to our items
const itemsWithIndex = sortedItems
.sort((a, b) => (String(a.categoryId) < String(b.categoryId) ? -1 : 1))
.sort((a, b) => {
const strA = String(a.categoryId);
const strB = String(b.categoryId);
if (strA < strB) {
return -1;
}
else if (strA === strB) {
return 0;
}
else {
return 1;
}
})
.map((item, index) => ({ ...item, index }));

// put the items inside their categories
Expand Down
4 changes: 2 additions & 2 deletions packages/react-forms/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as components from '.';
it('exports the expected number of components', () => {
expect(Object.keys(components)).toMatchInlineSnapshot(`
Array [
"Button",
"INPUT_ATTRIBUTES",
"InputCheckbox",
"InputColor",
"InputDate",
Expand All @@ -23,8 +25,6 @@ it('exports the expected number of components', () => {
"InvalidHandler",
"Label",
"TextArea",
"Button",
"INPUT_ATTRIBUTES",
]
`);
});
4 changes: 2 additions & 2 deletions packages/react-layouts/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import * as components from '.';
it('exports the expected named exports', () => {
expect(Object.keys(components)).toMatchInlineSnapshot(`
Array [
"Footer",
"Breadcrumb",
"Footer",
"Modal",
"NavBar",
"Tabs",
"Modal",
]
`);
});
4 changes: 2 additions & 2 deletions packages/theme/src/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ import { ThemeProvider as QuidThemeProvider } from './index';
it('exports all the expected modules', () => {
expect(Object.keys(exps)).toMatchInlineSnapshot(`
Array [
"ThemeProvider",
"colors",
"sizes",
"textStyles",
"withFallback",
"ThemeProvider",
"themes",
"withFallback",
]
`);
});
Expand Down
Loading

0 comments on commit 33ff4d9

Please sign in to comment.