Skip to content

Commit 2c1a30b

Browse files
docs: add FAQ section regarding overlay scroll behavior (#9470)
1 parent 1639e39 commit 2c1a30b

25 files changed

Lines changed: 162 additions & 6 deletions

File tree

components/auto-complete/doc/index.en-US.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,10 @@ When there is a need for autocomplete functionality.
5151
| `[nzValue]` | bind ngModel of the trigger element | `any` | - |
5252
| `[nzLabel]` | display value of the trigger element | `string` | - |
5353
| `[nzDisabled]` | disabled option | `boolean` | `false` |
54+
55+
## FAQ
56+
57+
### Q: The overlay layer element does not follow the scroll position when scrolling
58+
59+
By default, the overlay layer element uses body as the scroll container. If using another scroll container, add the [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) directive to the custom scroll container element.
60+
Note: You need to import the `CdkScrollable` directive or `ScrollingModule` module from `@angular/cdk/scrolling`.

components/auto-complete/doc/index.zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@ description: 输入框自动完成功能。
5252
| `[nzValue]` | 绑定到触发元素 ngModel 的值 | `any` | - |
5353
| `[nzLabel]` | 填入触发元素显示的值 | `string` | - |
5454
| `[nzDisabled]` | 禁用选项 | `boolean` | `false` |
55+
56+
## FAQ
57+
58+
### Q:滚动时浮层元素没有跟随滚动位置
59+
60+
默认情况下,浮层元素使用 `body` 作为滚动容器,如果使用了其他滚动容器,在自定义滚动容器元素上添加 [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) 指令。
61+
注意:您需要从 `@angular/cdk/scrolling` 导入 `CdkScrollable` 指令或 `ScrollingModule` 模块。

components/cascader/doc/index.en-US.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,8 @@ const filter: NzCascaderFilter = (i, p) => {
126126
When you pass a function to `nzLoadData`, the function becomes a `NzCascaderComponent` property.
127127
When the component calls the `nzLoadData` function, `this` is bound to nothing. You have to pass an arrow function or use `Function.bind` to bind `this` to the parent component.
128128
[see example](https://stackoverflow.com/questions/60320913/ng-zorro-cascader-lazy-load-data-nzloaddata-function-got-this-undefined/60928983#60928983).
129+
130+
### Q: The overlay layer element does not follow the scroll position when scrolling
131+
132+
By default, the overlay layer element uses body as the scroll container. If using another scroll container, add the [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) directive to the custom scroll container element.
133+
Note: You need to import the `CdkScrollable` directive or `ScrollingModule` module from `@angular/cdk/scrolling`.

components/cascader/doc/index.zh-CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,8 @@ const filter: NzCascaderFilter = (i, p) => {
138138
对传递给 Cascader 组件的 `nzLoadData` 参数会成为 `NzCasacderComponent` 对象的一个属性,调用这个函数时,函数中的 `this` 没有指向任何对象。
139139
因此,正确的做法是传递剪头函数,或者使用 `Function.bind``nzLoadData` 参数和你的对象绑定。
140140
[这里](https://stackoverflow.com/questions/60320913/ng-zorro-cascader-lazy-load-data-nzloaddata-function-got-this-undefined/60928983#60928983)是一个比较有代表性的例子。
141+
142+
### Q:滚动时浮层元素没有跟随滚动位置
143+
144+
默认情况下,浮层元素使用 `body` 作为滚动容器,如果使用了其他滚动容器,在自定义滚动容器元素上添加 [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) 指令。
145+
注意:您需要从 `@angular/cdk/scrolling` 导入 `CdkScrollable` 指令或 `ScrollingModule` 模块。

components/color-picker/doc/index.en-US.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,10 @@ Used when the user needs to customize the color selection.
5151
| `toHsbString` | Convert to `hsb` format color string, the return type like: `hsb(215, 91%, 100%)` | `() => string` | - |
5252
| `toRgb` | Convert to `rgb` object | `() => ({ r: number, g: number, b: number, a number })` | - |
5353
| `toRgbString` | Convert to `rgb` format color string, the return type like: `rgb(22, 119, 255)` | `() => string` | - |
54+
55+
## FAQ
56+
57+
### Q: The overlay layer element does not follow the scroll position when scrolling
58+
59+
By default, the overlay layer element uses body as the scroll container. If using another scroll container, add the [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) directive to the custom scroll container element.
60+
Note: You need to import the `CdkScrollable` directive or `ScrollingModule` module from `@angular/cdk/scrolling`.

components/color-picker/doc/index.zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,10 @@ description: 用于颜色选择。
5252
| `toHsbString` | 转换成 `hsb` 格式颜色字符串,返回格式如:`hsb(215, 91%, 100%)` | `() => string` | - |
5353
| `toRgb` | 转换成 `rgb` 对象 | `() => ({ r: number, g: number, b: number, a number })` | - |
5454
| `toRgbString` | 转换成 `rgb` 格式颜色字符串,返回格式如:`rgb(22, 119, 255)` | `() => string` | - |
55+
56+
## FAQ
57+
58+
### Q:滚动时浮层元素没有跟随滚动位置
59+
60+
默认情况下,浮层元素使用 `body` 作为滚动容器,如果使用了其他滚动容器,在自定义滚动容器元素上添加 [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) 指令。
61+
注意:您需要从 `@angular/cdk/scrolling` 导入 `CdkScrollable` 指令或 `ScrollingModule` 模块。

components/date-picker/doc/index.en-US.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,8 @@ You need to use `date-fns`. Date formatting currently supports two methods: `Dat
114114
default, [syntax reference](https://angular.dev/api/common/DatePipe)) and `date-fns` (
115115
see [`How to format a date using date-fns`](/docs/i18n/en#How%20to%20format%20a%20date%20using%20Date-fns)).NG-ZORRO
116116
takes the function provided by `date-fns` to implement date deserialization after using it.
117+
118+
### Q: The overlay layer element does not follow the scroll position when scrolling
119+
120+
By default, the overlay layer element uses body as the scroll container. If using another scroll container, add the [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) directive to the custom scroll container element.
121+
Note: You need to import the `CdkScrollable` directive or `ScrollingModule` module from `@angular/cdk/scrolling`.

components/date-picker/doc/index.zh-CN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,8 @@ registerLocaleData(zh);
112112
需要引入 `date-fns` 。日期格式化目前同时支持两种方式:`DatePipe`(默认,[语法参考](https://angular.cn/api/common/DatePipe)
113113
`date-fns`(见[如何使用 `date-fns` 进行日期格式化](/docs/i18n/zh#如何使用Date-fns进行日期格式化))。当你引入 `date-fns`
114114
后,NG-ZORRO 会使用它提供的 API 来进行反序列化。
115+
116+
### Q:滚动时浮层元素没有跟随滚动位置
117+
118+
默认情况下,浮层元素使用 `body` 作为滚动容器,如果使用了其他滚动容器,在自定义滚动容器元素上添加 [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) 指令。
119+
注意:您需要从 `@angular/cdk/scrolling` 导入 `CdkScrollable` 指令或 `ScrollingModule` 模块。

components/dropdown/doc/index.en-US.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,10 @@ Create dropdown with contextmenu, the detail can be found in the example above
5858
| -------- | --------------- | --------------------------------------------------------------------------- | ---------------------- |
5959
| create | create dropdown | `($event:MouseEvent \| {x:number, y:number}, menu:NzDropdownMenuComponent)` | `EmbeddedViewRef<any>` |
6060
| close | close dropdown | - | - |
61+
62+
## FAQ
63+
64+
### Q: The overlay layer element does not follow the scroll position when scrolling
65+
66+
By default, the overlay layer element uses body as the scroll container. If using another scroll container, add the [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) directive to the custom scroll container element.
67+
Note: You need to import the `CdkScrollable` directive or `ScrollingModule` module from `@angular/cdk/scrolling`.

components/dropdown/doc/index.zh-CN.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,10 @@ description: 向下弹出的列表。
5959
| --------- | ------------ | --------------------------------------------------------------------------- | ---------------------- |
6060
| create | 创建右键菜单 | `($event:MouseEvent \| {x:number, y:number}, menu:NzDropdownMenuComponent)` | `EmbeddedViewRef<any>` |
6161
| close | 关闭右键菜单 | - | - |
62+
63+
## FAQ
64+
65+
### Q:滚动时浮层元素没有跟随滚动位置
66+
67+
默认情况下,浮层元素使用 `body` 作为滚动容器,如果使用了其他滚动容器,在自定义滚动容器元素上添加 [CdkScrollable](https://material.angular.dev/cdk/scrolling/api#CdkScrollable) 指令。
68+
注意:您需要从 `@angular/cdk/scrolling` 导入 `CdkScrollable` 指令或 `ScrollingModule` 模块。

0 commit comments

Comments
 (0)