Skip to content

Commit

Permalink
Fixed some bugs and accessibility issues part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
natashapl committed Jul 26, 2024
1 parent 02dfdef commit 594ec55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
);
const movePatternToPage = useFormManagerStore(state => state.movePattern);
const focusPatternId = useFormManagerStore(state => state.focus?.pattern.id);
const focusPatternType = useFormManagerStore(state => state.focus?.pattern.type);
const focusPatternType = useFormManagerStore(
state => state.focus?.pattern.type
);

const isPatternInFieldset = useMemo(() => {
if (!focusPatternId) return false;
Expand All @@ -63,13 +65,16 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
const pages = useFormManagerStore(state =>
Object.values(state.session.form.patterns).filter(p => p.type === 'page')
);

const currentPageIndex = pages.findIndex(page =>
page.data.patterns.includes(focusPatternId || '')
);

const page1Count = pages.reduce((count, page) => count + (page.data.title === 'Page 1' ? 1 : 0), 0);


const page1Count = pages.reduce(
(count, page) => count + (page.data.title === 'Page 1' ? 1 : 0),
0
);

const availablePages: PageWithLabel[] =
page1Count > 1
? pages.slice(1).map((page, index) => {
Expand All @@ -84,7 +89,7 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
}
return page;
});

return availablePages;
};

Expand Down Expand Up @@ -182,7 +187,7 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
type="button"
ref={buttonRef}
aria-haspopup="true"
aria-expanded={dropdownOpen ? "true" : "false"}
aria-expanded={dropdownOpen ? 'true' : 'false'}
onClick={event => {
event.preventDefault();
toggleDropdown();
Expand All @@ -204,10 +209,7 @@ export const PatternEditActions = ({ children }: PatternEditActionsProps) => {
</button>
</p>
{dropdownOpen && (
<div
className={`${styles.dropDown} padding-2`}
tabIndex={-1}
>
<div className={`${styles.dropDown} padding-2`} tabIndex={-1}>
<div
className={`${styles.moveToPagePosition} margin-bottom-1`}
>
Expand Down
2 changes: 0 additions & 2 deletions packages/forms/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ export const movePatternBetweenPages = (
position: string,
isPageMove: boolean = false
): Blueprint => {

const sourcePage = bp.patterns[sourcePageId] as PagePattern;
const targetPage = bp.patterns[targetPageId] as PagePattern;

Expand Down Expand Up @@ -294,7 +293,6 @@ export const movePatternBetweenPages = (
};
};


export const addPatternToFieldset = (
bp: Blueprint,
fieldsetPatternId: PatternId,
Expand Down

0 comments on commit 594ec55

Please sign in to comment.