diff --git a/src/components/AdjustableSidebarWidth.vue b/src/components/AdjustableSidebarWidth.vue
index 9c60a894d..1e9971e09 100644
--- a/src/components/AdjustableSidebarWidth.vue
+++ b/src/components/AdjustableSidebarWidth.vue
@@ -37,6 +37,7 @@
/>
minWidthResponsivePercents[breakpoint] || 0,
maxWidthPercent: ({ breakpoint }) => maxWidthResponsivePercents[breakpoint] || 100,
- maxWidth: ({ maxWidthPercent, windowWidth }) => (
- calcWidthPercent(maxWidthPercent, windowWidth)
+ maxWidth: ({ maxWidthPercent, windowWidth, fixedWidth }) => (
+ Math.max(fixedWidth, calcWidthPercent(maxWidthPercent, windowWidth))
+ ),
+ minWidth: ({ minWidthPercent, windowWidth, fixedWidth }) => (
+ Math.min(fixedWidth || windowWidth, calcWidthPercent(minWidthPercent, windowWidth))
),
- minWidth: ({ minWidthPercent, windowWidth }) => calcWidthPercent(minWidthPercent, windowWidth),
widthInPx: ({ width }) => `${width}px`,
events: ({ isTouch }) => (isTouch ? eventsMap.touch : eventsMap.mouse),
asideStyles: ({
@@ -417,6 +424,7 @@ export default {
position: fixed;
top: var(--top-offset-mobile);
bottom: 0;
+ left: 0;
z-index: $nav-z-index + 1;
transform: translateX(-100%);
transition: transform 0.15s ease-in;
diff --git a/tests/unit/components/AdjustableSidebarWidth.spec.js b/tests/unit/components/AdjustableSidebarWidth.spec.js
index ebab43490..c3e21ef3c 100644
--- a/tests/unit/components/AdjustableSidebarWidth.spec.js
+++ b/tests/unit/components/AdjustableSidebarWidth.spec.js
@@ -554,6 +554,22 @@ describe('AdjustableSidebarWidth', () => {
expect(aside.classes()).toContain('hide-on-large');
});
+ it('allows hard-coding a width', async () => {
+ const wrapper = createWrapper({
+ propsData: {
+ fixedWidth: 200,
+ },
+ });
+ expect(wrapper.vm.asideStyles).toHaveProperty('width', '200px');
+ // simulate window changes width form orientation change.
+ // This should trigger both breakpoint emitter and window resize, but not in Jest
+ window.innerWidth = 1500;
+ window.dispatchEvent(createEvent('resize'));
+ await flushPromises();
+ assertWidth(wrapper, 200); // hardcoded width
+ expect(wrapper.find('.resize-handle').exists()).toBe(false);
+ });
+
describe('stores the content width in the store', () => {
function setContentWidth(wrapper, value) {
Object.defineProperty(wrapper.find({ ref: 'content' }).element, 'offsetWidth', {
diff --git a/tests/unit/views/DocumentationTopic.spec.js b/tests/unit/views/DocumentationTopic.spec.js
index 781792583..0e6967d96 100644
--- a/tests/unit/views/DocumentationTopic.spec.js
+++ b/tests/unit/views/DocumentationTopic.spec.js
@@ -182,6 +182,7 @@ describe('DocumentationTopic', () => {
expect(adjustableWidth.props()).toEqual({
shownOnMobile: false,
hiddenOnLarge: false,
+ fixedWidth: null,
});
const technology = topicData.references['topic://foo'];
expect(wrapper.find(NavigatorDataProvider).props()).toEqual({